Developer guide

How to clear Xcode DerivedData (and other Xcode caches)

Clear Xcode DerivedData in a few steps, and see which other Xcode folders are safe to delete and which are not.

3 safe2 careful1 never

updated read 4 minfor Xcode 16 and later on macOS 15 Sequoia and macOS 26 Tahoe

The short answer

  1. 01

    DerivedData is safe to delete, at ~/Library/Developer/Xcode/DerivedData. Xcode rebuilds it; the next build is a full one.

  2. 02

    Quit Xcode, then trash the folders inside it. Terminal: rm -rf ~/Library/Developer/Xcode/DerivedData/* deletes them for good.

  3. 03

    Clean Build Folder (Product menu) clears only the current project, not all of DerivedData.

  4. 04

    Keep Xcode Archives of shipped apps. They hold the dSYM files you need to read crash reports.

  5. 05

    iOS DeviceSupport is safe to delete. Xcode copies the symbols again when you connect that device.

~/Library/DeveloperExample Mac. Sizes are illustrative.
The Xcode folders under ~/Library/Developer, sized on an example Mac, with what each one costs you to delete.

What DerivedData is

To clear Xcode DerivedData, quit Xcode and delete the contents of ~/Library/Developer/Xcode/DerivedData. It holds everything Xcode generates while building: compiled products, the code index, build logs and a shared module cache. Each project gets a folder named after it plus a hash.

It is a cache, never your source files, and Xcode does not prune it. If your Mac is short on space in general, start with the full guide to freeing disk space on a Mac.

Which Xcode folders are safe to delete?

Xcode spreads data across several folders under ~/Library/Developer. They do not carry the same risk.

FolderVerdictWhat you lose
Xcode/DerivedDataSafeBuild products and the index. The next build is a full build.
Xcode/iOS DeviceSupport (also watchOS and tvOS)SafeCached device symbols. Xcode copies them again when you connect that device.
CoreSimulator/CachesSafeSimulator caches that regenerate while the runtime is installed.
Xcode/ArchivesCarefulFor shipped builds, the dSYM files used to symbolicate crash reports. Cannot be recreated.
CoreSimulator/DevicesCarefulApp data inside each simulator. See how to delete old iOS simulators.
Your project source and .xcodeprojNeverEverything. These are not caches.

Clear DerivedData from Xcode and Finder

  1. Open Xcode > Settings > Locations. The Derived Data field shows the path.
  2. Click the small arrow next to the path to reveal the folder in Finder.
  3. Quit Xcode.
  4. Move the folders inside DerivedData to the Trash, then empty the Trash.

To clear only your current project, use Product > Clean Build Folder (Shift+Cmd+K). The rest stays.

Clear DerivedData from Terminal

Quit Xcode first so it does not write into the folder while you delete it.

du -sh ~/Library/Developer/Xcode/DerivedData

Shows how much space DerivedData uses. Removes nothing.

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

Deletes every project's build data immediately, without using the Trash. Xcode recreates the folders on the next build.

If you changed the location in Settings > Locations, use that path instead.

Xcode Archives and dSYM files

Archives are in ~/Library/Developer/Xcode/Archives, grouped by date. Per Apple's documentation, an archive for distribution stores the binaries and dSYM files, and you should keep the archive for every build you distribute. A binary and a dSYM match only with identical build UUIDs, so a rebuild cannot replace a lost dSYM.

Deleting the archive of a build you shipped means you may no longer be able to symbolicate crash reports from that build. Delete only archives of builds that never shipped, or download the dSYMs from App Store Connect first. To review archives, use Window > Organizer > Archives and delete one at a time.

iOS DeviceSupport

When you connect a physical iPhone or iPad, Xcode copies the symbols for that OS version into ~/Library/Developer/Xcode/iOS DeviceSupport. watchOS and tvOS have matching folders. Each version is often several GB and Xcode never removes old ones.

Delete the subfolders for OS versions you no longer debug, not the parent folder. Xcode recreates them when a device on that version connects.

Other Xcode-related caches

  • Module cache. ModuleCache.noindex sits inside DerivedData and is removed with it.
  • Simulator caches. ~/Library/Developer/CoreSimulator/Caches holds per-runtime caches. They regenerate, so the space may come back until the runtime is removed.
  • SwiftUI Previews. Preview data lives under ~/Library/Developer/Xcode/UserData/Previews. Quit Xcode before touching it.
  • Xcode app cache. ~/Library/Caches/com.apple.dt.Xcode exists on most Macs. Apple does not document its contents, so treat it as a generic app cache and check its size first.

Move DerivedData instead of deleting it

In Xcode > Settings > Locations you can set Derived Data to Custom and pick another drive. An external-drive location has been reported to break framework tests on "My Mac", and a slow disk makes builds slower.

See every Xcode folder's size before you delete

Hoardless finds DerivedData (Auto tier), iOS, watchOS and tvOS DeviceSupport (Auto), Archives (Confirm) and CoreSimulator Caches (Auto) under ~/Library/Developer, shows each size, and previews the plan. Folders go to the Trash and are logged in the undo log. Simulator devices (Confirm) are cleaned with xcrun simctl delete unavailable.

See Hoardless

Questions

Is it safe to delete Xcode DerivedData?

Yes. DerivedData holds build products, intermediates, the index and logs, and Xcode regenerates all of it. You lose build time, not source code.

Where is DerivedData on a Mac?

By default at ~/Library/Developer/Xcode/DerivedData. Xcode > Settings > Locations shows the active path, which can be changed.

Does Clean Build Folder delete DerivedData?

No. It clears the build folder of the current project inside DerivedData. The other projects' folders stay.

Can I delete Xcode Archives?

Only for builds you never shipped. Archives of distributed builds contain the dSYM files that match those binaries, and a rebuild does not recreate the same dSYM.

What is iOS DeviceSupport and can I delete it?

It holds symbols copied from each physical device OS version you have debugged. It is safe to delete, and Xcode copies the symbols again when you connect that device.

Why is DerivedData so big?

Each project gets its own hash-named folder with intermediates, indexes and previews, plus a shared module cache. Xcode does not prune it for you.

What is ModuleCache.noindex?

Precompiled modules shared across builds, stored inside DerivedData. It is safe to delete and rebuilds on the next build.

Does deleting DerivedData delete my Archives?

No. Archives live in ~/Library/Developer/Xcode/Archives, outside DerivedData.