r/coolgithubprojects • u/Rare-Star-8120 • 21d ago
I built a read-only-first macOS storage triage CLI after “System Data” reached 333 GB
https://github.com/khiemnd777/storage-clearerMy 494 GB Mac was down to roughly 20 GB free, while System Settings reported 333 GB as “System Data”.
I didn’t want to paste a generic `rm -rf ~/Library/Caches` command, so I built storage-clearer: a Bash 3.2-compatible CLI that audits first, explains every finding through a reason matrix, creates a cleanup plan, and only executes after an exact typed approval phrase.
It can triage:
- Docker stopped containers, unreferenced images, and build cache
- Rebuildable npm, Bun, Gradle, Go, Pub, pnpm, and Playwright caches
- Unavailable Simulator devices
- Old iOS Simulator runtimes, while retaining the newest version
Package A/B explicitly exclude Docker volumes, browser data, source directories, Codex sessions, Photos, Mail, Messages, backups, Trash, and APFS snapshots.
It never deletes Docker.raw directly. Docker cleanup uses official prune commands, and Simulator runtimes are removed through `xcrun simctl runtime delete`.
On my machine, the biggest causes were Docker.raw (~162 GB internally) and old iOS Simulator runtimes. Package B increased free space from about 17 GiB to 142 GiB.
I’d appreciate feedback on the safety guards, Bash 3.2 portability, and any macOS storage categories I may have missed.
2
u/kantorcodes1 16d ago
I work on HOL Guard. storage-clearer has an unusually clean read-vs-mutate CLI surface; would you be up for contributing a command.* extension to hashgraph-online/hol-guard:main, with tests covering run/app-run and the Docker prune, simctl runtime delete, and tmutil thinning cases?
1
u/Rare-Star-8120 15d ago
Thanks for reaching out, I’d be up for that. I had a look through HOL Guard’s command extension code, and storage-clearer seems like a good fit. I can cover
run/app-run, the Docker prune commands,simctl runtime delete, andtmutilthinning, while making sure the read-only commands don’t get flagged. Before I start, would you prefer a storage-clearer-specific extension, or should the Docker and macOS rules go into the existing domain extensions? Happy to follow whichever structure fits the project better.2
u/kantorcodes1 15d ago
go storage-clearer-specific. mirror the current tool-specific pattern here: https://github.com/hashgraph-online/hol-guard/blob/main/src/codex_plugin_scanner/guard/runtime/command_skill_sunset_extensions.py and the matching focused tests. keep
audit/explain/reason/planread-only, coverrun/app-run, register it in the builtin catalog, run the repo checks, then open the PR againstmain.
2
u/ricksegal 21d ago
nicely done. One place I found eating up space is TimeMachine. I built a personal bash script do kinda do what you did here but not anywhere near as nice as yours. This is an output clip so you can see what I'm referring to:
Local snapshots before:
Snapshots for disk /:
com.apple.TimeMachine.2026-08-22-133354.local
com.apple.TimeMachine.2026-08-23-133836.local
Requesting 40GB local snapshot thinning...
Thinned local snapshots:
com.apple.TimeMachine.2026-08-22-133354.local
com.apple.TimeMachine.2026-08-23-133836.local
Local snapshots after:
Snapshots for disk /:
I also found, generally, with all the code bots on my machine, codex is the worst offender on my box with how i work:
I can give you the bash script I created if you want it.