DevCleaner Download .dmg

How to Clear Xcode DerivedData & Caches Safely

Xcode is usually the single biggest space hog on a developer's Mac. Here is everything it stores, what each folder costs you to delete, and the exact commands.

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:

LocationWhat it isTypical sizeRisk
Xcode/DerivedDataBuild intermediates, indexes, logs10–50 GBSAFE
CoreSimulator/CachesSimulator dyld caches2–10 GBSAFE
Xcode/iOS DeviceSupportDebug symbols per iOS version2–15 GBSAFE
CoreSimulator/DevicesThe simulators themselves + their data5–60 GBWARNING
Xcode/ArchivesYour .xcarchive builds (with dSYMs!)1–20 GBWARNING
Xcode/UserData/PreviewsSwiftUI preview caches1–5 GBSAFE

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

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
free · no account · 4 MB · macOS 14+

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.