Package Exports
- clean-disk-space
- clean-disk-space/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clean-disk-space) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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-space
and 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
|
๐ Smart Tracking
|
๐ช Powerful
|
๐ Quick Start
Installation
# Install globally
npm install -g clean-disk-space
# Or use without installing
npx clean-disk-space
Basic 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 --yes
Advanced 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 documentation
Options
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 --yes
monthly - 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