clean-my-mac
Safe, staged macOS disk cleanup for AI agents & developers. Recovers GBs from Xcode, Docker, node_modules, AI models, and caches with dry-ru
Open source Open in the app JSON README (API)
About
Safe, staged macOS disk cleanup for AI agents & developers. Recovers GBs from Xcode, Docker, node_modules, AI models, and caches with dry-run safety.
Details
- Kind
- Plugins
- Topic
- Cloud & DevOps
- Publisher
- shihabshahrier
- Origin
- gemini
- Category
- ferramentas
- Version
- 1.0.0
- Last push
- 2026-06-12T23:45:14Z
- Repository state
- ativo
- Language
- Shell
- License
- MIT
- Added
- 2026-08-30 14:13:39
- Updated
- 2026-08-30 14:13:39
- Origin id
shihabshahrier/clean-my-mac
README
# clean-my-mac π§Ή
> β‘ **Safe, staged macOS disk cleanup for developers and AI coding agents.** Recover GBs of storage from Xcode, Docker, node_modules, AI models, and system caches with 100% dry-run safety.
**clean-my-mac** is an intelligent, agent-compatible macOS utility designed to safely reclaim disk space from developer environments (such as Xcode DerivedData, Docker volumes, npm/pnpm/yarn caches, and Hugging Face AI models) and system cache bloat. Every cleanup action is profiled, previewed in a dry-run, and requires explicit per-phase confirmation.
---
## Agent Support
| Agent | Invocation | Install |
|-------|-----------|---------|
| Claude Code | `/clean-my-mac` or natural language | `claude plugin install clean-my-mac` |
| Cursor | `/clean-my-mac` | `.cursor/rules/clean-my-mac.mdc` (included) |
| Windsurf | `/clean-my-mac` | `.windsurf/rules/clean-my-mac.md` (included) |
| Cline | `/clean-my-mac` | `.clinerules/clean-my-mac.md` (included) |
| GitHub Copilot | natural language | `.github/copilot-instructions.md` (included) |
| Codex | `/clean-my-mac` | `.codex/config.toml` (included) |
| Gemini CLI | `/clean-my-mac` | `gemini-extension.json` (included) |
| Amp / Goose / opencode | `/clean-my-mac` | `bash install.sh` |
---
## What It Cleans
| Target | Risk | Notes |
|--------|------|-------|
| User & System Caches | π’ Low | Auto-regenerated by macOS |
| Logs & Trash | π’ Low | Always regenerated |
| Homebrew cache | π’ Low | `brew cleanup` re-downloads on demand |
| npm / pnpm / yarn caches | π’ Low | Rebuilt on next install |
| Xcode DerivedData | π’ Low | Rebuilt on next build |
| iOS Simulators | π‘ Medium | Re-downloadable from Xcode |
| Docker images | π‘ Medium | Re-pullable from registry |
| node_modules | π‘ Medium | Listed only β you choose |
| Time Machine snapshots | π‘ Medium | Backup confirmation required |
| AI model files | π΄ High | Listed only β you choose |
| Xcode Archives | π΄ High | Double confirmation required |
| iOS Device Backups | π΄ High | Guided to Finder only, never scripted |
Typical recovery on a 256 GB M1 Mac:
- Light developer: **5β15 GB**
- Active Xcode dev: **20β60 GB**
- Docker + Xcode + AI models: **30β100+ GB**
---
## Install
### All agents at once
```bash
git clone https://github.com/shihabshahrier/clean-my-mac.git
cd clean-my-mac
bash install.sh
```
### Claude Code (plugin)
```bash
claude plugin install shihabshahrier/clean-my-mac
```
Or from local clone:
```bash
claude plugin marketplace add /path/to/clean-my-mac
claude plugin install clean-my-mac
```
### Manual (any agent)
```bash
git clone https://github.com/shihabshahrier/clean-my-mac.git
mkdir -p ~/.claude/skills/clean-my-mac
cp -r clean-my-mac/skills/clean-my-mac/. ~/.claude/skills/clean-my-mac/
```
---
## Usage
In any supported agent, say:
```
"My Mac only has 20 GB left, help me clean it up"
"Free up disk space"
"Clean my Mac safely"
"What's taking up all my storage?"
```
Or invoke directly: `/clean-my-mac`
---
## How It Works
```
Phase -1 β Profile user (active tools, backup status, what to protect)
Phase 0 β Analyze disk β zero deletions, full size breakdown
Phase 1 β Safe caches & logs [LOW]
Phase 2 β Developer tools [LOWβMED]
Phase 3 β Docker [MEDIUM]
Phase 4 β AI model files [HIGH β list only]
Phase 5 β Time Machine snapshots [MEDIUM β backup confirmed first]
Phase 6 β Large file review [USER-DECIDES]
Phase 7 β iCloud optimization [guidance only]
β Final report
```
Every phase: profile check β dry-run preview β confirmation β execution.
---
## File Structure
```
clean-my-mac/
βββ skills/clean-my-mac/
β βββ SKILL.md β Skill definition (source of truth)
β βββ scripts/
β β βββ analyze_storage.sh β Phase 0: disk analysis
β β βββ cleanup_caches.sh β Phase 1: caches, logs, trash
β β βββ cleanup_homebrew.sh β Phase 2: Homebrew
β β βββ cleanup_xcode.sh β Phase 2: Xcode artifacts
β β βββ cleanup_node.sh β Phase 2: Node.js ecosystem
β β βββ cleanup_docker.sh β Phase 3: Docker
β β βββ cleanup_snapshots.sh β Phase 5: Time Machine snapshots
β βββ config/
β β βββ protected_paths.txt β Never-delete list
β β βββ safe_cleanup_rules.json β Rules per category
β βββ reference/
β βββ safe-paths.md
β βββ dangerous-paths.md
β βββ cleanup-strategies.md
β βββ macos-storage-guide.md
βββ .claude-plugin/ β Claude Code plugin manifest
βββ .cursor/rules/ β Cursor rules
βββ .windsurf/rules/ β Windsurf rules
βββ .clinerules/ β Cline rules
βββ .codex/ β Codex config
βββ agents/openai.yaml β Codex display config
βββ .github/copilot-instructions.md β Copilot instructions
βββ AGENTS.md β Codex / Amp / Goose context
βββ GEMINI.md β Gemini CLI context
βββ gemini-extension.json β Gemini CLI extension
βββ install.sh β Install to all agent paths
```
---
## Security
- `allowed-tools` restricts Claude to: `Bash`, `Read`, `Glob`, `Grep`, `Write`
- No network access during cleanup
- `config/protected_paths.txt` checked before every deletion
- Scripts use `set -euo pipefail` β fail fast on errors
- All operations logged to `~/clean-my-mac-log-<date>.txt`
- Every script supports `--dry-run` mode
- HIGH-risk operations require double confirmation
- iOS Device Backups: guided to Finder only, never scripted
---
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md). Read [CLAUDE.md](CLAUDE.md) first.
---
π **Project page:** https://shihub.online/projects/clean-my-mac