Xcode DerivedData, node_modules and Docker: what’s safe to delete on a developer’s Mac
A developer’s Mac fills up differently. Every project brings its own packages and build output, Xcode keeps build data and simulators for years, and Docker grows one big disk image. Almost all of it comes back with one install or build, which makes it the easiest space to get back, as long as you clear it in projects you’re not working on today.
- Rebuilds, so it’s safe: Xcode DerivedData, old iOS DeviceSupport,
node_modulesand virtual environments in old projects, and package manager caches (npm, pip, uv, Homebrew, Gradle, CocoaPods). - Use the tool’s own command: simulators (
xcrun simctl), Docker (docker system prune) and Homebrew (brew cleanup). - Keep: Xcode Archives of versions people still use, Docker volumes, and anything in a project you’re working on now.
Step 1: see where it went
This lists the usual suspects with their sizes, biggest last. Folders you don’t have are skipped:
du -sh ~/Library/Developer/Xcode/{DerivedData,Archives,"iOS DeviceSupport"} \
~/Library/Developer/CoreSimulator ~/.npm ~/.gradle ~/.cargo ~/.cache/uv \
~/Library/Caches/{Homebrew,pip,CocoaPods,Yarn} ~/.android \
2>/dev/null | sort -h
And every node_modules in your projects folder (change ~/Projects to wherever you keep code):
find ~/Projects -name node_modules -type d -prune -exec du -sh {} + 2>/dev/null | sort -h
Xcode
| Folder | What it is | Safe to clear? |
|---|---|---|
~/Library/Developer/Xcode/DerivedData | Build output, indexes and logs, one folder per project. | Rebuilds With Xcode quit. The next build of each project takes longer. |
~/Library/Developer/Xcode/iOS DeviceSupport | Debug symbols copied from every iOS version you’ve connected, often several GB each. | Rebuilds Old versions. Xcode copies them again when you plug in a device. |
~/Library/Developer/Xcode/Archives | Builds you exported or uploaded, with their debug symbols (dSYMs). | You decide Keep archives of versions people still run: you need them to read crash reports. |
~/Library/Developer/CoreSimulator/Devices | Every simulator, with the apps and data in it. | You decide Remove with simctl, below, not in Finder. |
~/Library/Developer/CoreSimulator/Caches | Simulator caches. | Safe |
Clear DerivedData with Xcode quit:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Simulators belong to Xcode, so remove them the way Xcode does. The first command removes simulators for iOS versions that are no longer installed; the next two list the simulator runtimes, which are several GB each, and delete one you don’t need:
xcrun simctl delete unavailable
xcrun simctl runtime list
xcrun simctl runtime delete <runtime-id>
Runtimes can also be removed in Xcode › Settings › Components (Platforms in older versions).
Node.js: node_modules and package caches
A node_modules folder is everything npm install downloaded for one project, and a few hundred MB each adds up fast across old projects. In any project you’re not working on, it’s safe to delete: npm install (or yarn, pnpm install) brings it back from the lockfile.
To pick them one by one from a list with sizes, run npx npkill in your projects folder. To remove them all in one folder tree without asking, which is only wise for old projects:
find ~/Projects/old -name node_modules -type d -prune -exec rm -rf {} +
The package managers’ own caches are also safe; they download again as needed:
npm cache clean --force
yarn cache clean
pnpm store prune
Python
- Virtual environments (
.venv,venv) in old projects: safe to delete when the project has arequirements.txt,pyproject.tomlor lockfile to rebuild them from. - Package caches:
pip cache purge,uv cache clean, andconda clean --allfor Conda. - Downloaded models from Hugging Face are often the biggest Python files on a Mac: see What AI tools leave on your Mac.
Docker
Docker Desktop keeps every image, container, volume and build cache inside one disk image, Docker.raw, in ~/Library/Containers/com.docker.docker. Never delete that file. Ask Docker what it can give back, then free it:
docker system df
docker system prune
docker builder prune
docker system prune removes stopped containers, unused networks, dangling images and build cache, and asks first. docker image prune -a also removes images no container uses, which then download again on the next pull. Volumes are left alone unless you add --volumes; they hold databases and other data, so leave them unless you’re sure. Docker.raw is a sparse file: Finder shows its maximum size, du -h shows what it really uses. To cap it, lower the disk limit in Docker Desktop’s Settings › Resources.
Homebrew, Gradle, Android, Rust, Go and CocoaPods
| Tool | Where | How to clear |
|---|---|---|
| Homebrew | ~/Library/Caches/Homebrew and old versions | brew cleanup, then brew autoremove for dependencies nothing needs |
| Gradle | ~/.gradle/caches | gradle --stop, then delete the folder. The next build downloads again. |
| Android | ~/.android/avd, plus SDK images | Delete emulators you don’t use in Android Studio’s Device Manager, and old system images in its SDK Manager |
| Rust | each project’s target folder, ~/.cargo/registry | cargo clean in old projects |
| Go | module cache | go clean -modcache |
| CocoaPods | ~/Library/Caches/CocoaPods, each project’s Pods | pod cache clean --all; pod install brings Pods back |
| Flutter | each project’s build folder | flutter clean in old projects |
What to keep
- Anything in a project you’re working on now: clearing it only costs you a rebuild.
- Xcode Archives of builds people still run, and Docker volumes.
~/.ssh,~/.gitconfig,~/.aws,~/.configand your keychain: keys, settings and logins, tiny and not replaceable.- Source code without a remote. Check
git statusandgit pushbefore you delete a whole project.
Or let SiftMac find the stale ones. It lists build folders and packages only in projects you haven’t changed for a month or more (you choose 1, 3 or 6 months), and only when the file that rebuilds them is there: package.json, requirements.txt, Cargo.toml and the like. Anything a running program is using is skipped. Xcode DerivedData, old device support and simulators are included, simulators are removed through simctl, and Docker is opt-in, freed with Docker’s own prune commands. Volumes are never touched.
Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works