Free up disk space on a Mac for developers
Short answer
On a developer’s Mac, most reclaimable space is in build caches and package downloads, and nearly all of it is safe to delete because the tools rebuild it. The biggest wins are usually Xcode DerivedData and simulators, Docker images and build cache, npm, pnpm and Yarn caches, Homebrew downloads, and downloaded AI models.
rm -rf ~/Library/Developer/Xcode/DerivedData
xcrun simctl delete unavailable
npm cache clean --force
brew cleanup --prune=all
pip cache purge
docker system prune
Xcode
| What | Path | Safe? |
|---|---|---|
| DerivedData (build cache) | ~/Library/Developer/Xcode/DerivedData | Yes. Rebuilt on the next build. |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | Yes. Recreated when you connect a device. |
| Simulator data | ~/Library/Developer/CoreSimulator | Ask first. You lose simulator app data. |
| Archives | ~/Library/Developer/Xcode/Archives | Keep archives of builds you shipped; they hold the symbols for crash reports. |
rm -rf ~/Library/Developer/Xcode/DerivedData
xcrun simctl delete unavailable
The second command removes simulators for runtimes you no longer have installed. To remove whole simulator runtimes, open Xcode → Settings → Components (called Platforms in Xcode 15). More detail: how to delete Xcode DerivedData.
Node: npm, pnpm, Yarn and node_modules
npm cache clean --force
pnpm store prune
yarn cache clean
Old node_modules folders in projects you no longer work on add up quickly. This lists the 20 largest:
find ~ -name node_modules -type d -prune -exec du -sh {} + 2>/dev/null | sort -h | tail -20
Deleting a node_modules folder is safe. Run your package manager’s install command to bring it back. More detail: how to clear npm cache and node_modules.
Python and AI tooling
pip cache purge
uv cache clean
Many tools also write to ~/.cache, including Hugging Face downloads. Downloaded models are often the largest thing on the disk. For Ollama:
ollama list
ollama rm <model-name>
Note: models are safe to remove but slow to get back. You will have to download them again.
Where each tool keeps its models: delete Ollama models on Mac.
Homebrew
brew cleanup --prune=all
brew autoremove
The first removes old versions and every cached download. The second removes dependencies nothing needs any more.
Docker
See what Docker is using first:
docker system df
Then remove stopped containers, unused networks, dangling images and build cache:
docker system prune
Careful: docker system prune -a --volumes also removes every image not used by a running container and all unused volumes. Volumes can hold database data that cannot be rebuilt.
Docker Desktop keeps everything inside one disk image, so Finder shows a single large file. Use the Docker commands rather than deleting that file by hand. More detail: Docker taking up too much space on Mac.
CocoaPods and Gradle
pod cache clean --all
rm -rf ~/.gradle/caches
Both download what they need on the next build.
Cursor and VS Code
The caches are safe to clear: ~/Library/Application Support/Cursor/Cache, ~/Library/Application Support/Cursor/CachedData and ~/Library/Application Support/Code/Cache.
Do not delete the User folder next to them. It holds your settings, keybindings, extensions state and chat history.
What to never delete
~/.ssh— your SSH keys.envfiles and API tokens.gitfolders — your commit history~/Library/Keychains— signing certificates and passwords- Editor
Userfolders — settings and chats - Docker volumes that hold data you need
iClearer has a Builders pack for this
iClearer’s Builders screen finds npm, pnpm, Yarn, pip and Homebrew caches, Xcode DerivedData, CocoaPods and Gradle caches, Cursor and VS Code caches, iOS Simulator data, Docker data and Ollama models, with the size of each. Rebuildable caches are labelled Safe; simulators, Docker and models are Ask first. API tokens, SSH keys, .env files and git repositories can never be selected.
Frequently asked questions
Is it safe to delete Xcode DerivedData?
Yes. DerivedData is Xcode’s build cache and index. Deleting it is safe; Xcode rebuilds it the next time you build, so that build will take longer than usual.
Is it safe to delete the npm cache?
Yes. The npm cache in ~/.npm holds downloaded packages. Run npm cache clean --force to clear it. npm downloads packages again when you next install them.
What does docker system prune remove?
It removes stopped containers, unused networks, dangling images and build cache. It does not remove volumes or images that are still tagged unless you add -a and --volumes, which can delete data you want to keep.
Why is my Mac storage full after installing Xcode?
Xcode itself is large, and it adds simulator runtimes, device support files and a DerivedData build cache that grows with every project. Deleting DerivedData and unused simulators usually returns the most space.
How do I find which developer folders are using the most space?
Run du -sh ~/Library/Developer ~/.npm ~/.cache ~/.gradle ~/.docker 2>/dev/null in Terminal to see the size of the common ones, or use a disk cleaner such as iClearer that lists developer caches by size.
Related guides
- How to delete Xcode DerivedDataXcode DerivedData can grow to tens of gigabytes. It is safe to delete. See where it is, three ways to clear it, and what else Xcode leaves on your disk.
- Docker taking up too much space on MacDocker Desktop stores everything in one growing disk image on your Mac. See what is using the space and the safe commands to reclaim it, without losing data.
- How to clear npm cache and node_modules on MacFree up disk space from Node.js on a Mac: clear the npm, pnpm, Yarn and Bun caches, find and delete old node_modules folders, and remove old Node versions.