npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

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.

Readme

🧹 clean-disk-space

npm version npm downloads License: MIT Node.js Version

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

  • 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-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

  1. Always dry-run first: clean-disk-space --dry-run
  2. Start with standard cleanup: Only use deep mode when necessary
  3. Monthly maintenance: Run clean-disk-space --yes monthly
  4. Before major updates: Use deep cleanup before macOS upgrades
  5. node_modules cleanup: Great for freeing 20GB+ for developers
  6. 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

GitHub Stars

Note: Always have backups of important data before running cleanup tools!