ShodhanaGuides

Is it safe to delete Xcode DerivedData?

Last updated: August 2026

Safe to delete

Yes. Everything in DerivedData is derived from your source and regenerates on the next build.

It costs you one full rebuild, a re-index, and — if you use Swift Package Manager — a network round trip to re-fetch package checkouts. Don't do it right before a flight.

du -sh ~/Library/Developer/Xcode/DerivedData 94G	/Users/you/Library/Developer/Xcode/DerivedData
Shodhana's Developer Tools category listing Xcode DerivedData at 6.89 GB, Docker's buildx build cache at 5.23 GB, a Cargo registry cache at 1.66 GB, and npm's _cacache at 1.03 GB, each with a last-used date.
DerivedData sized and dated next to the other rebuild-on-demand caches. Nothing here is preselected — the category is filed under "your call" precisely because the cost is a slow rebuild rather than lost data.

What is actually in there

DerivedData is Xcode's scratch space, one subfolder per project:

None of it is authored by you. Delete the lot and Xcode rebuilds it without complaint:

rm -rf ~/Library/Developer/Xcode/DerivedData/*

Quit Xcode first. Deleting the index out from under a running instance leaves autocomplete broken until you restart it anyway.

The one real cost: Swift Package Manager

This is the caveat that surprises people. SPM checkouts live inside DerivedData, at <Project>-<hash>/SourcePackages/checkouts. Clearing DerivedData deletes them, so your next build re-resolves every dependency over the network.

That is fine on a good connection. It is not fine offline, and it is not fine if a dependency's git host is having a bad day — you will be unable to build a project that compiled perfectly ten minutes earlier. If you need the space but want to keep the checkouts, delete the build directories only:

rm -rf ~/Library/Developer/Xcode/DerivedData/*/Build

Do not delete: Archives

Keep

~/Library/Developer/Xcode/Archives

Archives hold the dSYM debug symbols for builds you have shipped. Without the dSYM for a given build, crash reports from that version can never be symbolicated — you permanently lose the ability to read crash logs from every user still on that release. It is one of the few folders on a developer Mac with genuinely irreplaceable contents.

Archives are large, they sit one directory away from DerivedData, and "clean out ~/Library/Developer/Xcode" advice sweeps them up routinely. Keep an archive for every version still in the wild. Archives for versions nobody runs any more are safe to remove.

The same caution applies to ~/Library/Developer/Xcode/UserData, which holds your code snippets, key bindings, themes, and breakpoints. Small, and annoying to rebuild by hand.

Clean Build Folder is not the same thing

Three operations get used interchangeably and do different amounts of damage. In increasing order:

If you are here to fix a stale-build problem rather than to free space, Clean Build Folder is almost always the correct tool and costs a fraction of the rebuild time.

One shared item is worth knowing about: DerivedData/ModuleCache.noindex holds precompiled module artifacts shared across projects. It is safe, it is often several gigabytes, and it is a common cause of "impossible" compiler errors that vanish after clearing it.

Move it instead of clearing it

If you have an external drive, DerivedData does not have to live on your startup disk. Xcode → Settings → Locations → Derived Data lets you set a custom path, or switch to Relative to Workspace, which puts each project's build output in a DerivedData folder beside its own source.

Relative placement is the better default on a machine that is short on space: build output lives with the project, so deleting a project takes its build artifacts with it, and nothing accumulates under a hashed name for something you removed two years ago.

The rest of the Xcode footprint

DerivedData is rarely the largest item. The full picture:

FolderTypicalSafe?What deleting costs
DerivedData10–100 GBYes One full rebuild, re-index, SPM re-fetch.
iOS DeviceSupport5–60 GBYes Symbols re-download next time you attach a device running that iOS version. Needs the physical device.
CoreSimulator/Devices5–80 GBMostly Simulator app data, logins, and databases are wiped. The simulators themselves come back.
Caches/com.apple.dt.Xcode1–20 GBYes Nothing meaningful.
Archives2–50 GBNo Crash reports from shipped builds become unreadable, permanently.

For simulators, the targeted command beats deleting the folder — it removes only devices whose runtimes are no longer installed, leaving your working simulators and their data intact:

xcrun simctl delete unavailable

Why it grows back so fast

Xcode never garbage-collects DerivedData. A project you last opened in 2023 keeps its full build directory forever, under a folder name with a hash in it that gives no hint which project it belongs to. On most developer Macs the majority of DerivedData belongs to projects that no longer exist on disk.

That is the actual recurring problem, and it is why "delete everything and rebuild" is the usual advice — telling stale from active by hand means decoding hashed folder names one at a time.

Read next

Shodhana finds these per project rather than per folder — each DerivedData directory resolved back to the project that owns it, dated by last build, with Archives among the paths it refuses to touch.