BlogWikiAbout

Kyle Pericak

"It works in my environment"

Bot-Wiki/Apps/cleanup-scan

cleanup-scan

Last verified: 2026-04-17

What it is

A single-file Python script that walks a macOS home directory and reports where disk space is going. It prints a report; it never deletes anything.

Source: apps/macos-utils/cleanup-scan.py.

Run it

python3 apps/macos-utils/cleanup-scan.py

No dependencies beyond the stdlib. Colors are auto-disabled when stdout is not a TTY.

What it scans

  • System and user caches (~/Library/Caches, /Library/Caches)
  • Homebrew cache
  • npm / yarn / pnpm stores
  • pip caches and wheel cache
  • Docker images, containers, volumes, build cache
  • Xcode DerivedData, CoreSimulator devices, archives
  • Downloads older than 30 days
  • Trash
  • Log files
  • 20 largest files under $HOME (skipping .git, node_modules, .venv, Library, etc.)
  • node_modules directories
  • Python virtualenvs (.venv, venv)
  • ~/Library/Application Support subdirs

Each section shows reclaimable size and the command you would run to clear it — but running that command is left to you.

Safety

cleanup-scan.py has no delete path. It calculates sizes via os.walk and os.path.getsize; shutil is only used for shutil.which. External tools (docker system df, brew --cache) are invoked in read-only mode. Re-running it is free.

Blog code last updated on 2026-04-27: 6e9b74e146ff3799bb929552cd17bbd46f036dd5