Skip to content

guhcostan/mac-cleaner-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

72 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧹 Mac Cleaner CLI

Free & Open Source Mac cleanup tool

Scan and remove junk files, caches, logs, and more β€” all from your terminal.

npm version npm downloads CI License: MIT

Node.js Version Platform: macOS TypeScript Socket Badge

GitHub Stars

Support on Ko-fi

πŸͺŸ Also available for Windows: windows-cleaner-cli


⚑ Quick Start

npx mac-cleaner-cli

That's it! No installation needed. The CLI will:

  1. πŸ” Scan your Mac for cleanable files
  2. πŸ“‹ Show you what was found with sizes
  3. βœ… Let you select exactly what to clean
  4. πŸ—‘οΈ Clean the selected items safely

🎬 See It In Action

$ npx mac-cleaner-cli

🧹 Mac Cleaner CLI
──────────────────────────────────────────────────────

Scanning your Mac for cleanable files...

Found 44.8 GB that can be cleaned:

? Select categories to clean (space to toggle, enter to confirm):
  β—‰ 🟒 Trash                            2.1 GB (45 items)
  β—‰ 🟒 Browser Cache                    1.5 GB (3 items)
  β—‰ 🟒 Temporary Files                549.2 MB (622 items)
  β—‰ 🟑 User Cache Files                15.5 GB (118 items)
  β—‰ 🟑 Development Cache               21.9 GB (14 items)

Summary:
  Items to delete: 802
  Space to free: 41.5 GB

? Proceed with cleaning? (Y/n)

βœ“ Cleaning Complete!
──────────────────────────────────────────────────────
  Trash                          βœ“ 2.1 GB freed
  Browser Cache                  βœ“ 1.5 GB freed
  Temporary Files                βœ“ 549.2 MB freed
  User Cache Files               βœ“ 15.5 GB freed
  Development Cache              βœ“ 21.9 GB freed

──────────────────────────────────────────────────────
πŸŽ‰ Freed 41.5 GB of disk space!
   Cleaned 802 items

✨ Features

Feature Description
πŸš€ One Command Just run npx mac-cleaner-cli β€” no complex flags
🎯 Interactive Select exactly what you want to clean with checkboxes
πŸ›‘οΈ Safe by Default Risky items hidden unless you use --risky
πŸ” Smart Scanning Finds caches, logs, dev files, browser data, and more
πŸ“± App Uninstaller Remove apps completely with all associated files
πŸ”§ Maintenance Flush DNS cache, free purgeable space
πŸ”’ Privacy First 100% offline β€” no data ever leaves your machine
πŸ“¦ Minimal Dependencies Only 5 runtime deps, all from trusted maintainers

🎯 What It Cleans

🟒 Safe (always safe to delete)

Category What it cleans
trash Files in the Trash bin
temp-files Temporary files in /tmp and /var/folders
browser-cache Chrome, Safari, Firefox, Arc cache
homebrew Homebrew download cache
docker Unused Docker images, containers, volumes

🟑 Moderate (generally safe)

Category What it cleans
system-cache Application caches in ~/Library/Caches
system-logs System and application logs
dev-cache npm, yarn, pip, Xcode DerivedData, CocoaPods
node-modules Orphaned node_modules in old projects

πŸ”΄ Risky (use --risky flag)

Category What it cleans
downloads Downloads older than 30 days
ios-backups iPhone and iPad backup files
mail-attachments Downloaded email attachments
duplicates Duplicate files (keeps newest)
large-files Files larger than 500MB
language-files Unused language localizations

πŸ“– Usage

Basic Usage

# Interactive mode β€” scan, select, and clean
npx mac-cleaner-cli

# Include risky categories
npx mac-cleaner-cli --risky

Uninstall Apps

Remove applications completely with all their preferences, caches, and support files:

npx mac-cleaner-cli uninstall

Maintenance Tasks

# Flush DNS cache (may require sudo)
npx mac-cleaner-cli maintenance --dns

# Free purgeable space
npx mac-cleaner-cli maintenance --purgeable

Other Commands

# List all available categories
npx mac-cleaner-cli categories

# Manage configuration
npx mac-cleaner-cli config --init
npx mac-cleaner-cli config --show

# Manage backups
npx mac-cleaner-cli backup --list
npx mac-cleaner-cli backup --clean

πŸ’» Global Installation

If you use this tool frequently:

npm install -g mac-cleaner-cli
mac-cleaner-cli

πŸ”’ Security

βœ… Open Source All code publicly available for audit
βœ… No Network Operates 100% offline
βœ… Minimal Deps Only 5 runtime dependencies
βœ… CI/CD Every release tested with TypeScript, ESLint, and automated tests
βœ… Socket.dev Dependencies monitored for supply chain attacks

Found a vulnerability? Report it via GitHub Security Advisories.

πŸ› οΈ Development

git clone https://github.com/guhcostan/mac-cleaner-cli.git
cd mac-cleaner-cli
npm install
npm run dev      # Run in dev mode
npm test         # Run tests
npm run lint     # Run linter
npm run build    # Build for production

🀝 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 some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ’š Support

If this tool saved you time or disk space, consider supporting the project!

Support on Ko-fi

Your support helps maintain and improve this tool. Thank you! πŸ™

πŸ“„ License

MIT License β€” see LICENSE for details.


⚠️ Disclaimer
This tool deletes files from your system. While we've implemented safety measures, always ensure you have backups of important data.

Made with ❀️ for Mac users everywhere