How to Clear Derived Data in Xcode

Where Xcode keeps DerivedData, how to clear one project or all of it, the Terminal command, and what to do with Archives, DeviceSupport and simulators.

MacWipe 6 min read

To clear derived data in Xcode, quit Xcode, open ~/Library/Developer/Xcode/DerivedData in Finder and move the project folders inside it to the Trash. Xcode rebuilds what it needs on the next build, so the only cost is a slower first build afterwards.

This guide covers where the folder lives, how to clear one project or all of them, the Terminal command, and the other Xcode folders that take up space. The steps are the same on a MacBook Air, MacBook Pro or desktop Mac, and on macOS 14 Sonoma through macOS 27 Golden Gate, because the folder belongs to Xcode rather than to macOS.

What DerivedData is

DerivedData is where Xcode puts everything it generates from your source code: intermediate build files, compiled products, indexes and module caches. Apple’s Xcode Help on Locations settings puts it plainly: “By default, Xcode stores derived data for all of your projects in ~/Library/Developer/Xcode/DerivedData.”

Inside it you will find one folder per project, named after the project with a string of random letters on the end (for example MyApp-gnaccxmdetdk...). There are also shared folders such as ModuleCache.noindex and CompilationCache.noindex.

People clear it for two reasons:

  • Disk space. Every project you have ever built leaves a folder behind, including projects you deleted long ago.
  • Odd build errors. Stale indexes or cached modules can cause errors that a clean build fixes.

Find your DerivedData location

The default path works for most people, but a project can be set to keep its derived data somewhere else.

  1. Open Xcode.
  2. Choose Xcode > Settings, then click Locations.
  3. Look at the Derived Data row. Apple’s help page lists three options: Default, Relative (a folder next to your project, such as DerivedData) and Custom (any folder you pick).

If it says Default, the folder is at ~/Library/Developer/Xcode/DerivedData. To open it in Finder, choose Go > Go to Folder in Finder, paste the path and press Return.

To see how much space it uses, run this in Terminal:

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

Clear derived data for one project

Use this when a single project misbehaves and you don’t want to rebuild everything else.

  1. Quit Xcode (Xcode > Quit Xcode), so it isn’t writing to the folder while you delete it.
  2. In Finder, go to ~/Library/Developer/Xcode/DerivedData.
  3. Find the folder that starts with your project’s name.
  4. Drag it to the Trash, then empty the Trash when you are sure.
  5. Open the project again and build. The first build takes longer.

Clear all derived data

Same steps, but select everything inside the DerivedData folder (Command-A) and move it to the Trash. Leave the DerivedData folder itself in place. Xcode recreates anything it needs, and you lose nothing except build time.

Clear derived data from Terminal

If you prefer the command line, quit Xcode first and run:

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

Warning: rm -rf deletes permanently. Nothing goes to the Trash and there is no undo. Type the path exactly as shown: a typo or a space in the wrong place can point the command at a different folder. If you are not comfortable with that, use the Finder steps above instead.

Product > Clean Build Folder

Inside Xcode, Product > Clean Build Folder (Shift-Command-K) removes the build products for the open project only. An Apple engineer describes it on the Apple Developer Forums as removing “all those build products and intermediate files Xcode created for that project”. It is the gentlest option when one project won’t build, but it won’t clear space left by other projects.

Other big Xcode folders

DerivedData is rarely the only large folder. All of these sit under ~/Library/Developer in your home folder.

Archives: keep the ones you shipped

~/Library/Developer/Xcode/Archives holds one .xcarchive per Product > Archive, sorted into dated folders. Each archive contains the debug symbols (dSYM files) needed to read crash reports from that build. Apple’s documentation on building your app to include debugging information says you must keep the Xcode archive for each build you distribute, or you may not be able to diagnose crashes from it.

Safe to remove: archives of test builds you never shipped, and builds old enough that nobody runs them any more. Not safe: archives of versions still in the App Store or in testers’ hands.

iOS DeviceSupport

~/Library/Developer/Xcode/iOS DeviceSupport gets a new folder each time you connect a device running a version of iOS Xcode hasn’t seen before. Folder names include the device model and OS version, for example iPhone17,2 26.6.2 (23G90). You can delete folders for iOS versions your devices no longer run. If a device on that version connects again, Xcode creates the folder again. There are matching watchOS DeviceSupport, tvOS DeviceSupport and visionOS DeviceSupport folders if you develop for those.

Simulators (CoreSimulator)

~/Library/Developer/CoreSimulator holds your simulator devices (Devices), plus Caches and Temp. Don’t delete device folders by hand. Use the simctl tool that comes with Xcode instead.

To remove simulators that your current Xcode can no longer run:

xcrun simctl delete unavailable

Per xcrun simctl help delete, this “will delete devices that are not supported by the current Xcode SDK”. Any apps and data inside those simulators go with them. Apple’s DTS engineer suggests the same command in the forum thread above.

Simulator runtimes (the iOS, watchOS and other system images) are stored separately, outside your home folder. To see which are installed:

xcrun simctl runtime list

To delete one, use xcrun simctl runtime delete followed by its identifier from that list. The help text also offers --notUsedSinceDays <days> to remove runtimes you haven’t used lately, and --dry-run to preview what would go before anything is deleted. Run with --dry-run first.

What not to delete

  • Don’t delete ~/Library/Developer as a whole. It holds your simulators and their data, archives and other settings.
  • Don’t delete files under /private/var/folders by hand. Other apps and macOS use it for temporary data.
  • Don’t delete the Xcode app’s own files under /Applications/Xcode.app. To remove an old Xcode version, uninstall the whole app (see how to uninstall apps on Mac).

If Xcode isn’t the main thing filling your disk, start with how to check storage on Mac or how to find large files on Mac.

The faster way: MacWipe

MacWipe’s Developer tool lists each project’s DerivedData folder under the project’s name, labelled “Xcode build data: rebuilt on the next build”. Folders untouched for 30 days start selected. It also finds old iOS, watchOS, tvOS and visionOS device support (keeping the newest version per device model), simulator caches, simulators whose runtime is no longer installed, Xcode caches and older copies of Xcode. Old archives are listed, keeping the newest two per app, and are never pre-selected because of their crash symbols. Beyond Xcode it covers Android emulators, Gradle, CocoaPods, JetBrains caches and build folders such as node_modules in projects untouched for 30 days. Every item shows why it is safe, and what you approve moves to the Trash. Download MacWipe.

FAQ

Is it safe to delete derived data in Xcode?

Yes. Everything in DerivedData is generated from your project, and Xcode rebuilds it on the next build. You lose build time, not code or settings.

Where is the derived data folder in Xcode?

By default at ~/Library/Developer/Xcode/DerivedData. Check Xcode > Settings > Locations to see whether a project uses a relative or custom location instead.

How do I delete derived data from Terminal?

Quit Xcode, then run rm -rf ~/Library/Developer/Xcode/DerivedData/*. This deletes permanently, so check the path before pressing Return.

Does Clean Build Folder delete derived data?

It removes the build products and intermediate files for the open project only. To clear every project’s data, delete the contents of the DerivedData folder.

Skip the manual steps next time.

MacWipe's Smart Scan finds caches, logs, app leftovers and browser data in one pass, and shows every item and why it's safe before anything is removed. Scanning and your first clean are free.

What a year costs
MacWipe £23.99 a year for up to 3 Macs
CleanMyMac £30.95 a year for 1 Mac, £49.95 for 2
MacKeeper $89.40 for the first year for 3 Macs, shown in US dollars

Competitor prices from their own stores, checked on 27 October 2026. Both include features MacWipe doesn't have. See the sourced comparison

Comments 0

No comments yet.

Sign in to comment

More in Developer