What Xcode actually stores on your disk
Everything lives under ~/Library/Developer/. Run this to see the damage:
du -sh ~/Library/Developer/* | sort -hr
A typical active iOS developer's breakdown looks like this:
| Location | What it is | Typical size | Risk |
|---|---|---|---|
| Xcode/DerivedData | Build intermediates, indexes, logs | 10–50 GB | SAFE |
| CoreSimulator/Caches | Simulator dyld caches | 2–10 GB | SAFE |
| Xcode/iOS DeviceSupport | Debug symbols per iOS version | 2–15 GB | SAFE |
| CoreSimulator/Devices | The simulators themselves + their data | 5–60 GB | WARNING |
| Xcode/Archives | Your .xcarchive builds (with dSYMs!) | 1–20 GB | WARNING |
| Xcode/UserData/Previews | SwiftUI preview caches | 1–5 GB | SAFE |
DerivedData: the big one
It is safe to delete DerivedData. It contains nothing you authored — only build products, module caches, the source-code index and build logs. Xcode regenerates all of it. The cost: your next build of each project is a full rebuild, and indexing (autocomplete, jump-to-definition) takes a few minutes to come back.
rm -rf ~/Library/Developer/Xcode/DerivedData
Or per-project from Xcode itself: Settings → Locations → DerivedData → arrow icon, then delete the folder named after your project.
One real pitfall: never delete DerivedData while Xcode is mid-build. Swift Package Manager checkouts live inside it, and yanking them during a build fails it with confusing "missing package" errors. Quit Xcode first — or use a cleaner that detects the running app and warns you (DevCleaner does exactly this).
Simulators: where the silent gigabytes are
Each simulator device keeps its own data directory, and unavailable simulators — devices left over from old Xcode versions — keep theirs forever. Delete every simulator that the current Xcode can no longer use:
xcrun simctl delete unavailable
To see what each remaining simulator weighs:
du -sh ~/Library/Developer/CoreSimulator/Devices/* | sort -hr
Erasing a simulator's content (apps, photos, caches) without deleting the device:
xcrun simctl erase <device-udid>
iOS DeviceSupport: symbols you'll probably never need again
Every time you attach an iPhone running an iOS version Xcode hasn't seen, it copies that version's debug symbols to ~/Library/Developer/Xcode/iOS DeviceSupport — and never removes them. If you still have folders for iOS 15, it's time:
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*
Worst case, Xcode re-downloads symbols the next time you plug in a device — a few minutes, once per iOS version.
Archives: be careful here
~/Library/Developer/Xcode/Archives holds your .xcarchive bundles — including the dSYM files you need to symbolicate crash reports for versions that are live on the App Store. Delete old archives of versions nobody runs anymore; keep anything still in production. This is why archives should never be part of an automatic "clean everything" sweep.
The rest of the list
- SwiftUI Previews —
~/Library/Developer/Xcode/UserData/Previews, fully regenerable. - Old simulator runtimes — macOS keeps downloaded iOS runtimes as disk images. List them with
xcrun simctl runtime listand delete superseded ones withxcrun simctl runtime delete <id>. - Module cache — inside DerivedData, goes with it.
- Documentation cache —
~/Library/Caches/com.apple.dt.Xcode, safe.
Or skip the Terminal entirely
DevCleaner is a free macOS menu bar app that scans all of these locations (plus 21 other dev toolchains), labels every category Safe / Warning / Danger, never pre-selects anything risky, and warns if Xcode is running mid-build. One click, gigabytes back.
Download DevCleaner — free ↓FAQ
- Is it safe to delete Xcode DerivedData?
- Yes — it's all regenerable build state. The only cost is one full rebuild per project and a few minutes of re-indexing. Just don't do it while a build is running.
- How often should I clear it?
- Whenever it gets big or builds start behaving strangely. Many developers clear it monthly; an automatic age-based rule (e.g. "delete anything untouched for 30 days") keeps it bounded without losing warm caches for active projects.
- Does "Clean Build Folder" in Xcode do the same thing?
- No. ⇧⌘K only cleans the current project's build products. It leaves indexes, logs, other projects, and everything else in this guide untouched.
- Can I move DerivedData to an external disk?
- You can (Settings → Locations), but build performance suffers on anything slower than internal NVMe. Cleaning regularly is usually the better trade.