Xcode DerivedData
Quit Xcode. DerivedData lives at ~/Library/Developer/Xcode/DerivedData. It is often 10 to 50 GB. It is rebuildable cache, not your source, and Xcode rebuilds it on the next build.
rm -rf ~/Library/Developer/Xcode/DerivedData
Old simulators
Quit Xcode and Simulator first. Unavailable simulators are leftovers from an older Xcode. Delete them with simctl, not by removing the folder yourself.
xcrun simctl delete unavailable
Old iOS runtimes are separate disk images. List them, then delete one id you no longer need:
xcrun simctl runtime list
xcrun simctl runtime delete <id>
Package caches
These are download caches. The next install fetches them again. They do not delete your projects.
npm cache clean --force
yarn cache clean
pnpm store prune
brew cleanup
Yarn Berry (version 2 and later) uses yarn cache clean --all. Check yarn --version if yarn cache clean does not clear anything. brew cleanup removes stale Homebrew downloads and old formula versions.
Docker
Leave Docker running so these commands can see it. Look first, then prune. Quit Docker Desktop after that if you want the app closed.
docker system df
docker system prune
docker system prune removes stopped containers, dangling images, and unused networks. -a also removes unused images. --volumes also removes unused volumes, which can hold databases you cannot rebuild. Leave both flags off unless you mean to delete that data.
Project build folders
node_modules, .build, and target are safe to delete in projects you are not working on. Install or the next build puts them back. Leave the project you have open.
Free space can lag
Empty the Trash. Time Machine local snapshots can also hold the space, so Finder may not update right away. List those snapshots with:
tmutil listlocalsnapshots /
Clear the safe parts with DevCleaner
DevCleaner is a Mac app that finds and safely clears Xcode, npm, Docker and other developer caches.
Download DevCleaner for macOS ↓version 1.15.0 · macOS 14 Sonoma or later · Apple Silicon & Intel