| name | mac-cleaner-cli-disk-cleanup |
| description | Free disk space on macOS using an interactive CLI that clears caches, logs, Homebrew, Xcode junk, and more |
| triggers | ["clean up disk space on my mac","free disk space using mac cleaner","remove caches and logs from macos","clean homebrew and xcode cache","uninstall mac apps completely","scan mac for cleanable files","clear browser cache and temporary files","delete old node_modules folders"] |
mac-cleaner-cli Skill
Skill by ara.so — Devtools Skills collection.
What It Does
mac-cleaner-cli is a TypeScript-based CLI tool that helps free up disk space on macOS by cleaning:
- System and user caches
- Browser caches (Chrome, Safari, Firefox, Arc)
- Temporary files
- Development caches (npm, yarn, pip, Xcode DerivedData, CocoaPods)
- Homebrew downloads and cache
- Docker images and containers
- System logs
- Trash
- Orphaned node_modules
- iOS backups, downloads, mail attachments (risky categories)
Key features:
- Interactive checkbox selection
- Drill-down file explorer for granular control
- Safe by default (risky items require
--risky flag)
- App uninstaller with complete cleanup
- 100% offline, no telemetry
- Minimal dependencies
Installation
One-Time Usage (Recommended)
npx mac-cleaner-cli
Global Installation
npm install -g mac-cleaner-cli
mac-cleaner-cli
For Development
git clone https://github.com/guhcostan/mac-cleaner-cli.git
cd mac-cleaner-cli
bun install
bun run dev
Key Commands
Interactive Cleanup (Main Command)
npx mac-cleaner-cli
npx mac-cleaner-cli --risky
npx mac-cleaner-cli --risky -f
npx mac-cleaner-cli -A
npx mac-cleaner-cli --no-progress
Interactive controls:
↑↓ navigate items
← go back
→ drill into category (file explorer)
space toggle selection
a select all
i invert selection
⏎ submit/confirm
App Uninstaller
npx mac-cleaner-cli uninstall
Maintenance Tasks
npx mac-cleaner-cli maintenance --dns
npx mac-cleaner-cli maintenance --purgeable
Category Management
npx mac-cleaner-cli categories
Configuration
npx mac-cleaner-cli config --init
npx mac-cleaner-cli config --show
Backup Management
npx mac-cleaner-cli backup --list
npx mac-cleaner-cli backup --clean
Help and Version
npx mac-cleaner-cli --version
npx mac-cleaner-cli -V
npx mac-cleaner-cli --help
npx mac-cleaner-cli -h
Categories
Safe Categories (Always Safe)
| Category | Description |
|---|
trash | Files in 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 Categories (Generally Safe)
| Category | Description |
|---|
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 Categories (Requires --risky Flag)
| Category | Description |
|---|
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 |
Common Usage Patterns
Quick Disk Cleanup
npx mac-cleaner-cli
Developer Cleanup
npx mac-cleaner-cli
Deep Clean with Risky Categories
npx mac-cleaner-cli --risky
Drill Down into Specific Folders
npx mac-cleaner-cli
CI/CD Usage
Complete App Removal
npx mac-cleaner-cli uninstall
Configuration
The tool supports a configuration file for customizing behavior.
Initialize Config
npx mac-cleaner-cli config --init
This creates a config file at ~/.mac-cleaner-cli/config.json (exact location may vary).
View Current Config
npx mac-cleaner-cli config --show
Configuration Options
While the exact schema isn't fully documented in the README, typical options might include:
{
"defaultCategories": ["trash", "temp-files", "browser-cache"],
"excludePaths": [
"/Users/username/important-cache"
],
"backupBeforeClean": true,
"showAbsolutePaths": false
}
Troubleshooting
Permission Errors
Problem: "Permission denied" when cleaning certain files.
Solution:
sudo npx mac-cleaner-cli maintenance --dns
Categories Not Showing
Problem: Risky categories aren't visible.
Solution:
npx mac-cleaner-cli --risky
File Picker Not Available
Problem: Can't drill down into a category.
Solution:
npx mac-cleaner-cli -f
Large Scan Times
Problem: Scanning takes a long time.
Solution:
- This is normal for Macs with many files
- Consider excluding large directories if you have custom config
- The tool scans common locations efficiently
Accidental Deletion
Problem: Deleted something important.
Solution:
npx mac-cleaner-cli backup --list
Docker Cleanup Issues
Problem: Docker containers still running after cleanup attempt.
Solution:
docker stop $(docker ps -aq)
npx mac-cleaner-cli
Tool Not Found After Global Install
Problem: mac-cleaner-cli: command not found
Solution:
npm config get prefix
npx mac-cleaner-cli
Development Integration
Using in Scripts
import { scan, clean } from 'mac-cleaner-cli';
Building from Source
git clone https://github.com/guhcostan/mac-cleaner-cli.git
cd mac-cleaner-cli
bun install
bun run dev
bun run test
bun run lint
bun run build
Project Structure
mac-cleaner-cli/
├── src/ # TypeScript source code
├── tests/ # Test files
├── assets/ # Banner images, assets
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Documentation
Best Practices
- Always review before cleaning: Use the interactive checkboxes to verify what will be deleted
- Start with safe categories: Run without
--risky first
- Use file explorer: Press
→ on categories to select specific folders
- Keep backups: Enable backup settings in config for critical data
- Regular maintenance: Run weekly/monthly to prevent disk space issues
- Check app uninstaller: Use built-in uninstaller instead of dragging to Trash
- Monitor freed space: Note the summary after cleanup to track effectiveness
Security Notes
- 100% offline: No network requests, no telemetry
- Open source: All code available for audit at https://github.com/guhcostan/mac-cleaner-cli
- No root required: Runs as current user (except DNS flush with sudo)
- Minimal dependencies: Only 5 runtime dependencies, monitored by Socket.dev
- Safe defaults: Risky operations hidden behind
--risky flag
Platform Support
- macOS only: Designed specifically for macOS
- Node.js required: Check compatibility with
package.json (typically Node.js 16+)
- Windows alternative: See
windows-cleaner-cli for Windows support
Related Commands
df -h
du -sh ~/Library/Caches/*
brew cleanup --prune=all
docker system prune -a
rm -rf ~/Library/Developer/Xcode/DerivedData
ncdu /
Additional Resources