Clear Xcode, npm and Homebrew caches on a Mac, safely
Each tool has its own command, and each cache refills as you work. Clear what a tool makes again, keep what you cannot rebuild, and let Docker clean up after itself.
Found by the tools that made them, wherever they sit on the disk.
Every tool, its own way to clean up
Use the tool's own command where there is one. It knows what is safe better than any cleaner.
| What | The tool's own way | What changes |
|---|---|---|
| Xcode build cache~/ | In Xcode, Settings, then Locations, then the arrow beside Derived Data; quit Xcode and remove the folder's contents. | The next build of each project takes longer, once. |
| Old simulators~/ | xcrun simctl delete unavailable | Simulators for runtimes you no longer have are removed. |
| Device support files~/ | Remove the folders for iOS versions your devices no longer run. | Xcode copies them again when a device on that version connects. |
| npm cache~/ | npm cache clean --force | Packages download again on the next install. |
| pnpm store~/ | pnpm store prune | Only packages no project uses are removed. |
| Homebrew downloads~/ | brew cleanup | Old versions and downloaded bottles are removed. |
| pip cache~/ | pip cache purge | Wheels download again when needed. |
| Cargo build outputtarget/ | cargo clean in the project | The next build compiles from scratch. |
| Docker disk image~/ | docker system prune, inside Docker | Stopped containers and unused images go. Your volumes stay unless you add --volumes. |
What DiskKind adds to the commands
The commands clear one tool at a time. DiskKind shows them all at once, with the space each would really give back.
Every tool, in one scan
It recognises these folders by the tools and project files that own them, wherever they sit on the disk.
What would really come back
Each item shows its size on disk beside the space you would get back, so shared blocks never inflate the number.
Shown, never suggested
Docker's image, your simulators and anything holding your work are listed with no button. The rest moves to the Trash.
Questions developers ask
Is it safe to delete DerivedData?
Yes. Xcode rebuilds it the next time you build. The first build of each project takes longer, once.
Is it safe to clear the npm cache?
Yes. npm downloads packages again as you install them. Run npm cache clean --force.
Why is Docker using so much space on my Mac?
Docker Desktop keeps every image, container and volume inside one disk image that grows as you work. Clean it up inside Docker, for example with docker system prune, which removes stopped containers and unused images.
Can I delete node_modules?
Yes, in projects you can reinstall. Run npm install or your package manager's install command to get it back.
Find every developer cache at once.
DiskKind knows Xcode, npm, pnpm, Homebrew, pip, Cargo, Gradle and Docker by the folders they keep.
