Xcode, node_modules and Homebrew: the developer files that fill your Mac
Where Xcode, simulators, node_modules, Homebrew, Docker and other dev tools hide gigabytes on a Mac, with the safe commands to clean them.
Xcode
- DerivedData (
~/Library/Developer/Xcode/DerivedData): build products and indexes. Safe to delete; the next build is just slower once. - iOS DeviceSupport (
~/Library/Developer/Xcode/iOS DeviceSupport): debug symbols copied from every iPhone you connected. Xcode downloads them again when needed. - Archives (
~/Library/Developer/Xcode/Archives): your exported builds. They contain the dSYM files used to read crash reports of shipped versions. Keep those of versions in production. - Simulators: remove the ones you can no longer use with:
xcrun simctl delete unavailable
node_modules
Every JavaScript project carries its own node_modules, often several hundred megabytes. Projects you haven’t touched in months can lose theirs; npm install brings it back. To list them:
find ~/Projects -name node_modules -type d -prune -exec du -sh {} +
Replace ~/Projects with your own folder. Delete only in projects you can rebuild, and remember a fresh install needs the network.
The npm download cache lives in ~/.npm:
npm cache clean --force
Homebrew
brew cleanup -s
brew autoremove
The first removes old versions and cached downloads. The second removes dependencies nothing needs anymore. Installed packages are not touched.
Docker
Docker Desktop stores everything in one large disk image (Docker.raw) that grows and rarely shrinks. See what uses space:
docker system df
docker system prune removes stopped containers, unused networks and dangling images. Read its prompt: it deletes things you may still want.
Other build caches
- Rust:
cargo cleanin a project removes itstargetfolder. - Gradle:
~/.gradle/caches. - CocoaPods:
~/Library/Caches/CocoaPods. - pip:
pip cache purge.
And AI models
Local language models are now often the biggest item on a developer’s disk. See where they hide.
Undig’s Developer mode finds these folders, shows their real size, tells you how each one comes back, and flags projects you haven’t opened for months. Everything goes to the Trash first, with a Journal to undo it. For the general approach, see how to free up space on your Mac.