Xcode's DerivedData folder is the single biggest thing most Mac developers never look at. Here is where it lives, what is safe to delete, the three ways to clear it, and how to stop doing this by hand.
Every time Xcode builds, it writes the results somewhere it can reuse them: compiled objects,
linked products, the index that powers jump-to-definition, module caches, logs and
test results. All of that goes into DerivedData, one subfolder per project or
workspace, named like MyApp-abcdefghijklmnopqrstuvwxyz.
None of it is source. Everything in there is regenerated from your project the next time you build, which is exactly why it is safe to delete and exactly why it grows: Xcode writes generously and never cleans up after old projects, old branches or old simulators.
By default:
~/Library/Developer/Xcode/DerivedData
If you have changed it, the current location is in Xcode under Settings → Locations → Derived Data, and the small arrow next to the path opens it in Finder.
du -sh ~/Library/Developer/Xcode/DerivedData
Tens of gigabytes is normal on a machine that has been developing for a year. Over 100 GB is not rare. Each project's folder is listed separately, so this shows where it went:
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -h
Yes. Your projects, settings, signing identities and source code live elsewhere. Deleting DerivedData costs you one slow build per project while Xcode rebuilds, and the index comes back on its own after that build.
Product → Clean Build Folder (⇧⌘K) deletes the build products
for the current project. It is the gentlest option and the one to try first when a build is
acting strangely. It does not touch other projects or the shared module cache, so it rarely
gets much space back.
⇧⌘G) and paste
~/Library/Developer/Xcode/DerivedData.Quit Xcode, then:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
The trailing /* matters: it empties the folder instead of removing it. If you use a
custom location, substitute that path. There is no undo, which is the one argument for the Finder
route if you are unsure.
DerivedData is usually the largest item but not the only one. If you are still short on space after clearing it, these are the other regenerable folders, roughly in order of size:
~/Library/Developer/Xcode/iOS DeviceSupport — debug symbols for every iOS version
you have ever plugged in. Folders for versions you no longer test against can go.~/Library/Developer/CoreSimulator/Devices — simulators. Use
Xcode → Settings → Platforms or xcrun simctl delete unavailable
rather than deleting by hand.~/Library/Developer/Xcode/Archives — every archive you have built. Keep the ones
you shipped (they hold the dSYMs for crash symbolication) and delete the rest.~/Library/Caches/org.swift.swiftpm and ~/Library/Caches/com.apple.dt.Xcode
— package and Xcode caches. Safe to clear, rebuilt on demand.DerivedData refills because that is its job. Every branch switch, every dependency bump and every Swift toolchain update invalidates part of it, and Xcode keeps the old pieces around. On a busy machine it is back to tens of gigabytes within weeks, which is why most people clear it only when the disk-full dialog forces them to.
The fix is to clean it on a trigger instead of on a crisis. The moment Xcode quits is ideal: the whole folder is regenerable at that point and nothing is using it. A daily clean or a size limit works too, as long as the clean is careful about what Xcode has open.
Dustpan shows DerivedData's size in the menu bar and cleans it automatically when Xcode quits,
on Product → Clean Build Folder, daily, or past a size limit, with one click or
⌘⇧K for right now. While Xcode is running it keeps anything written in the last
minute and anything a running app is using, or leaves open projects alone entirely if you
prefer. It is sandboxed, has no network access, and is a modern successor to the long-retired
Watchdog for Xcode.
Dustpan on the Mac App Store · $4.99 · macOS 15 or later on Apple silicon