clean-disk-space
v1.0.2
Published
π§Ή The first comprehensive macOS cleanup tool for npm! No Homebrew or Python needed. Clean disk space with npx - from trash to node_modules, caches to Docker. Safe, interactive, and tracks space freed. System-wide cleanup made simple.
Maintainers
Readme
π§Ή clean-disk-space
The first comprehensive macOS cleanup tool available as an npm package! π
No Homebrew required. No Python dependencies. Just
npx clean-disk-spaceand go.
Clean up gigabytes of unnecessary files with confidence. Features space tracking, dry-run mode, and two cleanup levels (safe & aggressive).
# Install globally
npm install -g clean-disk-space
# Or use instantly with npx (no installation needed!)
npx clean-disk-spaceπ― Why clean-disk-space?
Unlike other macOS cleanup tools, clean-disk-space is:
β npm-Native
- No Homebrew needed (unlike
mac-cleanup) - No Python required (unlike
mac-cleanup-py) - Works instantly with
npx- zero setup!
β Comprehensive
- System-wide cleanup (not just node_modules like
npkill) - Cleans Homebrew, Docker, Xcode, caches, logs, and more
- All in one command
β Developer-Friendly
- Built for the Node.js ecosystem
- Zero external dependencies
- Interactive confirmations for safety
- Tracks exactly how much space you freed
β Safe by Default
- Preview mode with
--dry-run - Shows what will be deleted before deletion
- No sudo required
- Never touches system files
π Comparison with Alternatives
| Feature | clean-disk-space | mac-cleanup | mac-cleanup-py | npkill | |---------|------------------|-------------|----------------|--------| | Installation | npm/npx | Homebrew | pip | npm | | External Dependencies | β None | β Homebrew | β Python | β None | | System-wide Cleanup | β Yes | β Yes | β Yes | β No | | node_modules Cleanup | β Yes | β No | β No | β Yes | | Docker Cleanup | β Yes | β Yes | β Yes | β No | | Xcode Cleanup | β Yes | β Yes | β Yes | β No | | Space Tracking | β Yes | β No | β No | β No | | Dry-run Preview | β Yes | β No | β Yes | β No | | Built-in Docs | β Yes | β No | β No | β No | | Works with npx | β Yes | β No | β No | β Yes |
clean-disk-space is the only npm-native, comprehensive macOS cleanup tool!
β¨ Features
π‘οΈ Safety First
- Dry-run mode to preview
- Interactive confirmations
- Color-coded warnings
- No system files touched
π Smart Tracking
- Before/after sizes
- Total space freed
- Detailed breakdowns
- Progress indicators
πͺ Powerful
- Standard + Deep modes
- Built-in documentation
- Zero dependencies
- Lightning fast
π Quick Start
Installation
# Install globally
npm install -g clean-disk-space
# Or use without installing
npx clean-disk-spaceBasic Usage
# Preview what will be cleaned (recommended first run)
clean-disk-space --dry-run
# Run interactive cleanup
clean-disk-space
# Auto-confirm all safe operations
clean-disk-space --yesAdvanced Usage
# Deep cleanup (node_modules, Docker, etc.) - with confirmations
clean-disk-space deep
# Preview deep cleanup
clean-disk-space deep --dry-run
# View full documentation
clean-disk-space docsπΊ Demo
$ clean-disk-space --dry-run
ββββββββββββββββββββββββββββββββββββββββββ
β π§Ή macOS Disk Space Cleaner β
ββββββββββββββββββββββββββββββββββββββββββ
β οΈ DRY RUN MODE - No changes will be made
πΎ Disk Space:
Total: 500GB
Used: 450GB (90%)
Available: 50GB
π¦ Emptying Trash...
Current size: 2.3GB
πΎ Would free: 2.3GB
πΊ Cleaning Homebrew cache...
Can free: ~1.2GB
ποΈ Cleaning user caches...
Current size: 3.5GB
πΎ Would free: 3.5GB
β¨ Cleanup complete!
Run with --deep for aggressive cleanupπ§Ή What Gets Cleaned
π¦ Standard Cleanup (Safe - Default)
| Item | What It Does | Typical Space Freed | Safe? |
|------|--------------|---------------------|-------|
| ποΈ Trash | Empties ~/.Trash | 0-5GB | β
Yes |
| πΊ Homebrew Cache | Removes old downloads | 0.5-2GB | β
Yes |
| π Browser Caches | Safari, Chrome caches | 1-5GB | β
Yes |
| π¦ npm Cache | Cached packages | 0.5-2GB | β
Yes |
| π§Ά Yarn Cache | Cached dependencies | 0.5-2GB | β
Yes |
| π Old Logs | Logs older than 30 days | 0.1-1GB | β
Yes |
| π± Xcode DerivedData | Build artifacts (rebuilds automatically) | 5-20GB | β
Yes* |
*Requires confirmation
Total Typical Savings: 2-10GB πΎ
π₯ Deep Cleanup (Aggressive)
| Item | What It Does | Typical Space Freed | Requires Confirmation | |------|--------------|---------------------|----------------------| | π node_modules | Removes all node_modules folders | 5-50GB | β οΈ Yes | | π³ Docker | Unused images/containers | 1-10GB | β οΈ Yes | | π CocoaPods | iOS dependency cache | 0.5-5GB | β οΈ Yes | | π€ Gradle | Android build cache | 1-10GB | β οΈ Yes | | π¦ Xcode Archives | App distribution builds | 5-50GB | β οΈ Yes |
Total Typical Savings: 10-50GB+ πΎ
π― Commands & Options
Commands
clean-disk-space # Standard cleanup (default)
clean-disk-space deep # Aggressive cleanup
clean-disk-space help # Show help
clean-disk-space docs # Show full documentationOptions
| Option | Alias | Description |
|--------|-------|-------------|
| --dry-run | -d | Preview without making changes |
| --yes | -y | Auto-confirm all prompts |
| --verbose | -v | Detailed output |
| --help | -h | Show help |
π Common Workflows
ποΈ Monthly Maintenance
# Quick monthly cleanup (safe)
clean-disk-space --yesπΎ Low Disk Space Emergency
# Step 1: Preview standard cleanup
clean-disk-space --dry-run
# Step 2: Run standard cleanup
clean-disk-space
# Step 3: Preview deep cleanup
clean-disk-space deep --dry-run
# Step 4: Run deep cleanup (will ask for confirmation)
clean-disk-space deepπ Exploration Mode
# Learn what it does
clean-disk-space docs
# See what would be cleaned
clean-disk-space --dry-run
clean-disk-space deep --dry-runπ Before Major Updates
# Free maximum space before macOS update
clean-disk-space deep --dry-run
clean-disk-space deepπ‘οΈ Safety Features
β What's Safe to Delete
- β Application caches (rebuilds automatically)
- β Package manager caches (re-downloads on demand)
- β Old log files (>30 days)
- β Trash contents
- β Build artifacts (can rebuild)
β οΈ What Requires Confirmation
- β οΈ node_modules: Shows full list before deletion
- β οΈ Docker images: May remove images you need
- β οΈ Xcode Archives: App distribution builds (backup first!)
- β οΈ Build caches: Gradle, CocoaPods
β What's NEVER Deleted
- β System files
- β Applications
- β User documents
- β Active project files
- β Recent logs (<30 days)
π‘ Pro Tips
- Always dry-run first:
clean-disk-space --dry-run - Start with standard cleanup: Only use deep mode when necessary
- Monthly maintenance: Run
clean-disk-space --yesmonthly - Before major updates: Use deep cleanup before macOS upgrades
- node_modules cleanup: Great for freeing 20GB+ for developers
- Keep backups: Especially before cleaning Xcode Archives
π§ Requirements
- OS: macOS 10.15 (Catalina) or later
- Node.js: v12.0.0 or later
- Permissions: Terminal access (no sudo required for most operations)
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
MIT Β© CVSRohit
π Links
- npm Package: https://www.npmjs.com/package/clean-disk-space
- GitHub Repository: https://github.com/CVSRohit/clean-disk-space
- Report Issues: https://github.com/CVSRohit/clean-disk-space/issues
β Show Your Support
If this tool helped you free up disk space, please consider:
- β Starring the repository
- π Writing a review
- π€ Contributing improvements
- π¬ Sharing with others
Made with β€οΈ for the macOS community
Note: Always have backups of important data before running cleanup tools!
