Installation
ccusage can be installed and used in several ways depending on your preferences and use case.
Why No Installation Needed?
Thanks to ccusage's incredibly small bundle size, you don't need to install it globally. Unlike other CLI tools, we pay extreme attention to bundle size optimization, achieving an impressively small footprint even without minification. This means:
- ✅ Near-instant startup times
- ✅ Minimal download overhead
- ✅ Always use the latest version
- ✅ No global pollution of your system
Quick Start (Recommended)
The fastest way to use ccusage is to run it directly:
bunx ccusagepnpm dlx ccusagenpx ccusage@latestSpeed Recommendation
We recommend bunx for everyday use. ccusage can run on Node.js 22+, but Bun generally starts faster and avoids the slower cold-start path common with npx.
Because the published CLI shebang targets Node.js, package runners can start ccusage under Node.js even when launched through bunx. When ccusage finds bun in PATH, it automatically re-runs the bundled entrypoint with Bun for better warm runtime performance. Set CCUSAGE_BUN_AUTO_RUN=0 to force the Node.js runtime.
Performance Comparison
Here's why runtime choice matters:
| Runtime | First Run | Subsequent Runs | Notes |
|---|---|---|---|
| bunx | Fast | Instant | Recommended for everyday use |
| pnpm dlx | Fast | Fast | Good alternative |
| npx | Slow | Moderate | Widely available, Node.js 22+ |
Global Installation (Optional)
While not necessary due to our small bundle size, you can still install ccusage globally if you prefer:
npm install -g ccusagebun install -g ccusageyarn global add ccusagepnpm add -g ccusageAfter global installation, run commands directly:
ccusage daily
ccusage monthly --breakdown
ccusage blocks --liveDevelopment Installation
For development or contributing to ccusage:
# Clone the repository
git clone https://github.com/ryoppippi/ccusage.git
cd ccusage
# Install dependencies
pnpm install
# Run directly from source
pnpm --filter ccusage start daily
pnpm --filter ccusage start monthly --jsonDevelopment Scripts
# Run tests
pnpm run test
# Type checking
pnpm typecheck
# Build distribution
pnpm --filter ccusage build
# Lint and format
pnpm run formatRuntime Requirements
Node.js
- Minimum: Node.js 22.x for the published package
- Recommended: Use Bun for command execution when available
npx, npm global installs, pnpm, and yarn all use the Node.js runtime unless ccusage re-runs through Bun
Bun
- Minimum: Bun 1.3+
- Recommended: Latest stable release
- Recommended for
bunx ccusageand for the fastest warm startup
Verification
After installation, verify ccusage is working:
# Check version
ccusage --version
# Run help command
ccusage --help
# Test with daily report
ccusage dailyUpdating
Direct Execution (npx/bunx)
Always gets the latest version automatically.
Global Installation
# Update with npm
npm update -g ccusage
# Update with bun
bun update -g ccusageCheck Current Version
ccusage --versionUninstalling
Global Installation
npm uninstall -g ccusagebun remove -g ccusageyarn global remove ccusagepnpm remove -g ccusageDevelopment Installation
# Remove cloned repository
rm -rf ccusage/Troubleshooting Installation
Permission Errors
If you get permission errors during global installation:
# Use npx instead of global install
npx ccusage@latest
# Or configure npm to use a different directory
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH# Use nvm
nvm install 22
npm install -g ccusage
# Or use fnm
fnm install 22
npm install -g ccusageNetwork Issues
If installation fails due to network issues:
# Try with different registry
npm install -g ccusage --registry https://registry.npmjs.org
# Or use bunx for offline-capable runs
bunx ccusageVersion Conflicts
If you have multiple versions installed:
# Check which version is being used
which ccusage
ccusage --version
# Uninstall and reinstall
npm uninstall -g ccusage
npm install -g ccusage@latestNext Steps
After installation, check out:
- Getting Started Guide - Your first usage report
- Configuration - Customize ccusage behavior
- Daily Usage - Understand daily usage patterns