From clean-my-mac
macOS system cleanup skill that replicates CleanMyMac X functionality via terminal. Cleans caches, logs, temporary files, old iOS backups, mail attachments, Xcode junk, package manager caches, saved application state, runs maintenance scripts, flushes DNS, purges memory, empties all trash bins, and scans for large/old files. Safe by default with dry-run mode and optional aggressive cleaning. Triggers on: "clean my mac", "free up space", "disk cleanup", "system cleanup", "clear caches", "clean mac", "mac cleanup", "system junk", "CleanMyMac".
How this skill is triggered — by the user, by Claude, or both
Slash command
/clean-my-mac:clean-my-macThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Replicates the core functionality of CleanMyMac X entirely via terminal commands.
Replicates the core functionality of CleanMyMac X entirely via terminal commands. Safe, transparent, and configurable.
| Command | What it does |
|---|---|
/clean-my-mac | Full system cleanup (safe defaults) |
/clean-my-mac scan | Dry-run scan — shows what can be cleaned and sizes, cleans nothing |
/clean-my-mac full | Aggressive cleanup including optional areas |
/clean-my-mac caches | Clear user & system caches only |
/clean-my-mac logs | Clear user & system logs only |
/clean-my-mac xcode | Clear Xcode derived data, archives, device support |
/clean-my-mac dev | Clear all dev tool caches (npm, pip, brew, yarn, cocoapods, gradle) |
/clean-my-mac mail | Clear mail attachment downloads |
/clean-my-mac trash | Empty all trash bins (user + external drives) |
/clean-my-mac ios | Remove old iOS backups and software updates |
/clean-my-mac maintenance | Run macOS periodic scripts, flush DNS, purge RAM |
/clean-my-mac large-files | Find large files (>100MB) sorted by size |
/clean-my-mac old-files | Find files not accessed in 6+ months over 50MB |
/clean-my-mac with no args)/clean-my-mac scan)Run all size checks but clean nothing. Display a full report of reclaimable space.
/clean-my-mac full)Clean everything including optional/aggressive categories. Still ask before deleting iOS backups.
These are always safe to clean — they will be regenerated as needed by macOS and apps.
rm -rf ~/Library/Caches/*
rm -rf /Library/Caches/*
rm -rf ~/Library/Logs/*
sudo rm -rf /Library/Logs/*
sudo rm -rf /var/log/*.log /var/log/*.gz
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
rm -rf ~/Library/Logs/DiagnosticReports/*
rm -rf /Library/Logs/DiagnosticReports/*
rm -rf ~/Library/Application\ Support/CrashReporter/*
rm -rf ~/Library/Saved\ Application\ State/*
rm -rf ~/.Trash/*
sudo rm -rf /Volumes/*/.Trashes/* 2>/dev/null
# npm
npm cache clean --force 2>/dev/null
# yarn
yarn cache clean 2>/dev/null
# pip
pip3 cache purge 2>/dev/null
# Homebrew (removes old versions and download cache)
brew cleanup --prune=all -s 2>/dev/null
# CocoaPods
rm -rf ~/Library/Caches/CocoaPods 2>/dev/null
# Gradle
rm -rf ~/.gradle/caches/* 2>/dev/null
# Maven
rm -rf ~/.m2/repository 2>/dev/null # Only in full mode — can be slow to re-download
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Developer/Xcode/Archives/*
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
rm -rf ~/Library/Developer/CoreSimulator/Caches/*
sudo periodic daily weekly monthly
sudo purge
full mode or specific subcommand)These contain user data that may or may not be wanted. Always confirm before deleting.
# Show size first, ask before cleaning
rm -rf ~/Library/Containers/com.apple.mail/Data/Library/Mail\ Downloads/*
# List backups with dates first, let user choose
ls -lht ~/Library/Application\ Support/MobileSync/Backup/
# Then remove selected or all:
rm -rf ~/Library/Application\ Support/MobileSync/Backup/*
rm -rf ~/Library/iTunes/iPhone\ Software\ Updates/*
rm -rf ~/Library/iTunes/iPad\ Software\ Updates/*
docker system prune -a --volumes # DESTRUCTIVE — always confirm
rm -rf ~/.m2/repository # Slow to redownload — only in full mode
find ~ -type f -size +100M -not -path "*/Library/*" -not -path "*/.Trash/*" \
-not -path "*/node_modules/*" -not -path "*/.git/*" \
-exec ls -lhS {} + 2>/dev/null | head -30
find ~ -type f -size +50M -atime +180 -not -path "*/Library/*" \
-not -path "*/.Trash/*" -not -path "*/node_modules/*" \
-not -path "*/.git/*" \
-exec ls -lhS {} + 2>/dev/null | head -30
Display results in a table and let user choose which to delete.
Category Size Status
─────────────────────────────────────────────────
User Caches 5.2 GB Will clean
System Caches 340 MB Will clean
User Logs 875 MB Will clean
System Logs 120 MB Will clean
Saved Application State 52 KB Will clean
Xcode DerivedData 2.1 GB Will clean
Xcode Archives 890 MB Will clean
npm Cache 412 MB Will clean
Homebrew Cache 230 MB Will clean
pip Cache 85 MB Will clean
Crash Reports 12 MB Will clean
Trash 1.6 GB Will clean
Mail Downloads 340 MB Skipped (use 'full' mode)
iOS Backups 8.2 GB Skipped (use 'ios' subcommand)
Docker 4.5 GB Skipped (use 'full' mode)
─────────────────────────────────────────────────
Total reclaimable: ~12.1 GB (safe) / ~25.1 GB (full)
Cleanup complete!
Before: 35 GB free
After: 47 GB free
Freed: ~12 GB
Cleaned:
- User & system caches
- User & system logs
- Xcode build data
- Package manager caches
- Crash reports & diagnostics
- Trash emptied
- DNS cache flushed
- Memory purged
- Maintenance scripts executed
~/Downloads, ~/Documents, ~/Desktop, or any user document folder contents.app bundles2>/dev/null to suppress "no such file" noiserm -rf / or any variation — all paths must be fully qualifiedsudo (system logs, maintenance scripts, purge)npx claudepluginhub loevlie/clean-my-mac-plugin --plugin clean-my-macAutomates macOS disk cleanup and memory monitoring with Mole-based safety guards and LaunchAgent alerting. Responds to low disk space, kernel panics, and vm-compressor shortages on Apple Silicon.
Reclaims disk space on a Mac dev machine by deleting regenerable caches (Cargo, node_modules, pnpm/npm, OS/app caches) and thinning APFS local snapshots. Invoke with /dev-clean-mac when low on disk.
Analyzes local Mac disk usage, validates snapshot completeness, and identifies cleanup candidates. Defaults to dry-run preview and requires explicit approval before any deletion. Useful when disk usage is high or user wants to understand disk growth.