How to clear Xcode and other developer caches on a Mac
Developer machines fill up quietly. Xcode, simulators, package managers and old project folders can hold tens of gigabytes, and most of it can be regenerated. The trick is knowing which part is rebuildable and which is not.
Disclosure: Sweepvault is made by the MacAppKit team, who publish this site, so weigh our view accordingly.
The usual suspects, and the built-in way to clear them
| What | Where | Safe to remove? |
|---|---|---|
| Xcode DerivedData | ~/Library/Developer/Xcode/DerivedData | Yes. Xcode rebuilds it; the next build is slower |
| Simulator runtimes and devices | Xcode > Settings > Platforms; xcrun simctl delete unavailable | Yes, but runtimes must be re-downloaded if needed |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | Usually; Xcode re-creates it when you reconnect a device, which takes time |
| Archives | Xcode > Window > Organizer | Only if you no longer need those builds; they hold your submitted binaries and symbols |
| Package caches | for example npm cache, ~/.gradle/caches, ~/.cargo/registry, Homebrew | Yes, they download again; use the tool's own command where there is one, such as brew cleanup |
| Project build folders | node_modules, Rust target, Swift .build, Python virtual environments | Yes in old projects; reinstall when you return to them |
To find the weight first, run du -sh ~/Library/Developer/* 2>/dev/null. Quit Xcode before deleting anything in its folders. The in-Xcode command Product > Clean Build Folder only cleans the current project, so it does not clear the whole DerivedData directory.
Doing it with Sweepvault
- Run Smart Scan. Developer data appears under Developer junk (Xcode build data, device support, archives), Package and model caches (Homebrew, pip, Cargo, Go, Maven, Hugging Face, conda and others) and Old project build folders (node_modules, Rust target, Swift .build, Python venvs).
- Open Cleanup and read the labels. Xcode DerivedData, simulator caches, the documentation cache, SwiftUI preview data and device logs are marked safe and are deleted, since Xcode recreates them. Device support files and archives are marked for review and go to the undo vault if you remove them. Package caches and project build folders are marked for review and not pre-selected, because you may not want to redownload everything.
- Tick what you want to clear, press Clean, and watch the progress. Anything that went to the vault can be restored from the Recovery tab within 30 days.
- The Space tab shows a map, which helps find a build folder in a project you forgot.

Limits
- Sweepvault does not delete simulator runtimes or simulator device data; it clears simulator caches. Remove runtimes in Xcode > Settings > Platforms or with
xcrun simctl. - Archives and device support files are only suggested for review. If you rely on an old archive for symbolication, keep it.
- Maven's local repository can hold artifacts you built yourself (from
mvn install), which cannot be downloaded again. Sweepvault therefore sends it to the vault instead of deleting it. - It does not run tool commands such as
docker system pruneorbrew cleanup; for those, use the tool. - Do not clean while a build is running. The first build after clearing DerivedData will be slow.
A sensible routine
Once a month, run a scan, clear DerivedData and old build folders, and clean package caches only when you need the space. Keep recent archives. Our general guide to a full Mac covers the non-developer parts.
Why not just delete ~/Library/Developer?
Because it is not all cache. The folder also holds things you may want: archives of builds you shipped, device support files that take a long time to fetch again, and in some setups simulator devices with test data inside them. Deleting the whole folder is a blunt move that is hard to reverse. Clearing the rebuildable parts first, one at a time, usually frees most of the space for much less risk. After clearing, open your project, let Xcode re-index, and confirm a clean build works before moving on to the next folder.