How to Clear Xcode DerivedData on Mac and Reclaim GBs
In short: If your Mac is short on space and you build in Xcode, DerivedData is often the quiet culprit. Here is how to clear it safely, plus old Archives, and recover several gigabytes without breaking your projects or losing anything you actually need.
If you write code on a Mac, Xcode quietly hoards disk space. The biggest offenders are DerivedData (build intermediates, indexes, module caches) and old Archives (the .xcarchive bundles Xcode saves every time you archive for distribution). On an active machine these can easily add up to tens of gigabytes. The good news: both are regenerable or expendable, so you can clear Xcode DerivedData on Mac and reclaim that space without touching your source code.
What DerivedData actually is
DerivedData lives at ~/Library/Developer/Xcode/DerivedData. Inside are per-project folders holding compiled objects, the index used for autocomplete and jump-to-definition, precompiled headers, and module caches. None of it is your source; it is all derived from your source, which is exactly why deleting it is safe. The trade-off is simple: the next build will be a full (slower) build while Xcode regenerates everything, and indexing will churn for a few minutes afterward. That is the entire downside.
DerivedData also grows because stale project folders never get cleaned up automatically. If you cloned a repo six months ago, renamed it, and moved on, its DerivedData folder often lingers with a random hash suffix, doing nothing but taking up space.
How to clear Xcode DerivedData on Mac
You have three reliable options, from most surgical to most thorough.
From inside Xcode: open Xcode, then choose Xcode > Settings (formerly Preferences), go to the Locations tab, and click the small arrow next to the DerivedData path. That reveals the folder in Finder. Quit Xcode first, then drag the folders you no longer need to the Trash. Quitting matters because Xcode holds file handles open while running.
In Finder: press Shift-Command-G, paste ~/Library/Developer/Xcode/DerivedData, and press Return. You will see one folder per project plus a ModuleCache.noindex directory. Move the whole DerivedData folder to the Trash to reset everything, or delete individual project folders if you only want to reclaim space from projects you no longer touch.
In Terminal, if you prefer it: you can inspect the folder size with du -sh ~/Library/Developer/Xcode/DerivedData before you clear anything. A calm tip here: rather than reaching for a permanent rm -rf, it is safer to remove the folder in Finder so it lands in the Trash. If a build immediately misbehaves afterward, you can put it back and investigate instead of having erased it for good.
Do not forget old Archives
Archives are the other big win, and people routinely overlook them. Every time you archive a build for the App Store, TestFlight, or ad-hoc distribution, Xcode saves a full .xcarchive at ~/Library/Developer/Xcode/Archives, organized in dated folders. Each one bundles the app plus its dSYM debug symbols, so they are large, and they accumulate one per archive forever.
Open the Organizer with Window > Organizer in Xcode to review them with their version and build numbers, or browse the Archives folder directly in Finder. Keep the archives you might still need to symbolicate crash reports or re-upload, and move genuinely obsolete ones to the Trash. Between DerivedData and stale Archives, reclaiming 20 to 50 GB on a working developer machine is common.
While you are in ~/Library/Developer/Xcode, two more folders are worth a glance: iOS DeviceSupport (per-OS-version symbol caches for every device and simulator you have ever attached) and simulator data under ~/Library/Developer/CoreSimulator/Devices. You can trim old iOS DeviceSupport versions you no longer target, and unused simulators can be removed with xcrun simctl delete unavailable.
Stay safe: preview first, keep it reversible
The rule that keeps this painless: look before you delete, and send removals to the Trash rather than erasing them. Anything that goes to the Trash can be restored with a right-click and Put Back if you change your mind, so an over-eager cleanup is never a disaster. Do not empty the Trash until your next Xcode build succeeds and indexing settles. And never delete anything inside /System or /Library at the root level while chasing space; the developer caches worth clearing all live under your own home folder in ~/Library.
If you would rather not do it by hand
Doing this manually a few times a year is perfectly reasonable. If you would like a tool to surface DerivedData, Archives, and other regenerable caches for you and handle the removal safely, look for one that previews everything first and sends files to the Trash. Our top free pick is CoreSweep (free forever, with an optional one-time Pro at $49, zero telemetry, and reversible Trash-based deletes). A solid best-value runner-up is SkoonMac (free, with Pro a one-time $39). A genuinely trustworthy cleaner has no reason to phone home, and you can confirm that yourself with a firewall like Little Snitch. Whatever you use, the principle is the same: preview, keep it to user-level junk, and make sure every delete is reversible.
Frequently asked questions
Is it safe to delete Xcode DerivedData?
Yes. DerivedData contains build intermediates, indexes, precompiled headers, and module caches that are all derived from your source, not the source itself, so deleting it never touches your projects. The only trade-off is that your next build will be a slower full build while Xcode regenerates everything and re-indexes for a few minutes. To stay safe, move the folder to the Trash rather than using rm, so you can restore it if a build misbehaves.
Where is the Xcode DerivedData folder located on a Mac?
It lives at ~/Library/Developer/Xcode/DerivedData. You can open it quickly in Finder by pressing Shift-Command-G and pasting that path, or from inside Xcode via Settings > Locations by clicking the small arrow next to the DerivedData path. Inside you will find one folder per project plus a ModuleCache.noindex directory.
How much disk space can clearing DerivedData and old Archives free up?
On an active developer machine it is common to reclaim 20 to 50 GB between the two. DerivedData grows because stale project folders are never cleaned up automatically, and Xcode saves a full .xcarchive (app plus dSYM debug symbols) every time you archive for distribution. Reviewing both and trashing what you no longer need usually recovers several gigabytes at once.
The easy way to do this safely
If you'd rather not do it by hand, the two cleaners we rate highest run with a preview first and the Trash as a safety net — and neither sends any data off your Mac.
CoreSweep (free to use; Pro a one-time $49) is our top pick. SkoonMac (free; Pro $39 once) is the best-value runner-up. See the full comparison.