Is it safe to delete Xcode DerivedData?

What Xcode leaves behind: macOS Storage settings showing the Developer category at 16.94 GB, with the note "Remove project build caches and unused SDKs to free storage space" and a Manage in Xcode button.

Yes, you can delete Xcode DerivedData. Quit Xcode, empty ~/Library/Developer/Xcode/DerivedData, and the next build recreates everything. Your source code, Git history, project files, and signing setup do not live there. The cost is time: one slow full build and a re-index before autocomplete and jump-to-definition feel normal again. Apple's own Xcode 26 release notes tell developers to "clean out the DerivedData for the project" as part of the workaround for certain build failures.

The harder question is everything next to it. Xcode's real footprint is mostly in ~/Library/Developer, not in Xcode.app. Device support files, simulators, runtimes, and Archives pile up there too, and they do not all carry the same risk. One of them (Archives) cannot be rebuilt at all.

This guide covers what each folder is, how to measure it, and the order to clear it by hand. You can follow every step without installing anything. If the space you are chasing is not from Xcode, start with what system data is on a Mac instead.

What DerivedData actually holds

Open Xcode → Settings → Locations. The Derived Data row shows the current path, with a small arrow that opens it in Finder. The default is ~/Library/Developer/Xcode/DerivedData, but a custom location set here (or a build script using xcodebuild -derivedDataPath) puts it somewhere else. Trust the arrow over the default path.

Inside, you will see one folder per project, named like MyApp-abcdefghijklmnop. Each holds build products, intermediates, the index that powers code completion, and build logs. Swift packages for that project land in SourcePackages/checkouts inside the same folder. Apple Developer Forums threads show package sources at DerivedData/<project>/SourcePackages/checkouts/<package>. Those copies are part of DerivedData, so deleting the project folder deletes them. The next build checks them out again. Your source, and the package dependencies recorded in the project, are not in that folder.

Beside the project folders are shared caches, ModuleCache.noindex and CompilationCache.noindex. The second one is covered in the next section. Reports of total DerivedData size vary a lot. The original Stack Overflow question on this topic started with a 22 GB folder. No average will tell you what yours holds, so measure it (below).

CompilationCache.noindex

CompilationCache.noindex sits at the top of DerivedData, at ~/Library/Developer/Xcode/DerivedData/CompilationCache.noindex, next to the per-project folders, not inside them. That is the default. Xcode 27 can keep this cache in a custom location, so if the folder is not there, check Xcode → Settings → Locations. Xcode 26's release notes introduce compilation caching as an opt-in feature for Swift and C-family languages. It caches the result of compiling a set of source files and, when the same files are compiled again, serves the previous result. The notes say the workflows that benefit most are switching branches and clean builds. You turn it on with the Enable Compilation Caching build setting, or in per-user project settings.

Yes, it is safe to delete, with Xcode quit. It is cache, not your source, Git history, signing, or archives. You lose cached compilation results, so the next build of a project that has the setting on does that work again. In an Apple Developer Forums thread titled "Xcode 16.3 DerivedData size problem", one developer's DerivedData jumped from about 21 GB to 48 GB after an update, another reported CompilationCache.noindex alone at 27 GB, and a later reply notes it regenerates as soon as it is deleted. Those are their reports. Measure the folder before you decide it is the problem:

du -sh ~/Library/Developer/Xcode/DerivedData/CompilationCache.noindex

ModuleCache.noindex, beside it, is the shared precompiled-module cache. Same rule: safe to delete, and rebuilt as you compile.

Clean Build Folder is not a disk cleanup

Product → Clean Build Folder (Shift-Command-K) removes build products for the project you have open. It is a troubleshooting tool. It leaves the index, the shared module and compilation caches, every other project's folder, device support files, simulators, and Archives in place.

So if you ran Clean Build Folder and free space barely moved, nothing went wrong. You need to delete the folders themselves. Xcode 27 adds a menu item for that: Product → Delete Derived Data…, covered in the cleanup order below.

Why Storage shows it as Developer or System Data

In System Settings → General → Storage, macOS sometimes groups Xcode's build data under a Developer category, listed as "Project Build Data and Indexes", with a Delete option. That entry is DerivedData across all your projects.

The rest of ~/Library/Developer often ends up in System Data, because Storage categories are groupings, not folders. If System Data is still huge after you clear Xcode's leftovers, local Time Machine snapshots and VM disks are the next suspects. The Mac system data guide covers those. If Docker is the other half, see how to shrink Docker.raw. Caches that are not Xcode's are in how to clear cache on Mac.

Measure before you delete

Quit Xcode and Simulator, then paste this into Terminal. It only reads sizes:

du -sh ~/Library/Developer/Xcode/DerivedData \ ~/Library/Developer/Xcode/*DeviceSupport \ ~/Library/Developer/Xcode/Archives \ ~/Library/Developer/Xcode/DocumentationCache \ ~/Library/Developer/CoreSimulator/Devices \ ~/Library/Developer/CoreSimulator/Caches \ ~/Library/Developer/XCTestDevices \ ~/Library/Developer/Xcode/UserData/Previews \ ~/Library/Caches/com.apple.dt.Xcode 2>/dev/null

To see which projects inside DerivedData are the heavy ones:

du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -h

Which folder is which project

The folder name is the project plus a hash. That is enough when you remember the project, and useless when you do not. Each project folder contains info.plist. The WorkspacePath key is the project or workspace that folder belongs to. This only reads the plists:

for f in ~/Library/Developer/Xcode/DerivedData/*/info.plist; do [ -f "$f" ] || continue printf '%s\n' "$f" plutil -extract WorkspacePath raw "$f" done

plutil -extract prints the value and does not write the file. /usr/libexec/PlistBuddy -c 'Print :WorkspacePath' on the same plist is the same lookup. Skip a folder with no info.plist. The shared caches, ModuleCache.noindex and CompilationCache.noindex, are not project folders.

In Finder, use Go → Go to Folder (Shift-Command-G) and paste any of those paths. Deleting from Finder sends things to Trash, which gives you an undo. Storage will not change until you empty it.

A cleanup order, safest first

Work top to bottom and stop once you have enough room. The early steps cost you rebuild time. The later ones cost downloads, simulator state, or data you cannot get back.

1. Quit Xcode and Simulator

Deleting DerivedData while Xcode is indexing or building tends to produce strange errors until you restart anyway. Quit both first. The one exception is Xcode 27's own menu item below, which runs inside Xcode.

2. Delete DerivedData

Pick one:

On macOS 15 or later, use the built-in trash command. It moves the folders to the Trash, the same as Finder, so you can still put them back:

trash ~/Library/Developer/Xcode/DerivedData/*

The trash manual page says it first appeared in macOS 15.0. Free space only goes up once you empty the Trash.

macOS 13 and 14 do not have trash. Use rm -rf there instead:

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

rm -rf skips the Trash, so double-check the path. Neither command needs sudo. If you see forum advice that adds sudo here, ignore it. The folder belongs to your user, and running rm -rf as root only raises the stakes of a typo.

If one project is misbehaving, you can delete only its Name-hash folder and leave the rest warm. Use WorkspacePath above to pick the folder.

Swift package checkouts

Deleting a project folder also deletes SourcePackages/checkouts, the resolved copies of its Swift packages. The next build checks them out again. That is checkout time, not lost source. The package dependencies recorded in the project stay where they are, because they are not inside DerivedData.

3. Clear simulator caches and dead simulators

~/Library/Developer/CoreSimulator/Caches is safe to empty. The first simulator boot afterwards is slower.

For simulator devices, let the tools do it. This removes devices whose runtime your current Xcode no longer supports:

xcrun simctl delete unavailable

Devices you still use but no longer need can go from Window → Devices and Simulators. Deleting a simulator wipes the apps and data installed on it, so keep any that hold test accounts or a state you set up by hand.

4. Clear SwiftUI Previews simulators

SwiftUI previews run on their own simulator devices, kept apart from the ones in the run menu, in ~/Library/Developer/Xcode/UserData/Previews. xcrun simctl delete unavailable does not touch them. With Xcode quit, this deletes every preview device:

xcrun simctl --set previews delete all

--set previews points simctl at the preview devices instead of your normal simulators. Xcode creates them again the next time you open a canvas, so the first preview is slower. Apple's documentation does not cover this command. It is the fix developers trade on the Apple Developer Forums for broken previews. With Xcode 27, simctl reports that --set previews uses UserData/Previews/Simulator Devices. Clear only the Previews folder this way. The rest of UserData holds your themes and key bindings.

5. Remove old DeviceSupport versions

Each time you connect a physical device running a new OS version, Xcode copies support files into folders such as:

Old versions pile up across phone upgrades. The accepted Ask Different answer is that it is safe to delete old ones, and suggests sorting by Date Modified to see which are still in use. Keep the versions that match devices you still debug on. If you delete one you needed, Xcode copies it again the next time that device connects. You wait a few minutes, nothing breaks.

6. Remove simulator runtimes you no longer test against

Runtimes are full OS images, and they are often the biggest single items after an Xcode upgrade or two. Use Xcode → Settings → Components, not Finder. The section below is what that screen lists, and the Terminal commands that match it.

7. Documentation and Xcode app caches

~/Library/Developer/Xcode/DocumentationCache re-downloads when you browse docs. ~/Library/Caches/com.apple.dt.Xcode is an ordinary app cache that Xcode rebuilds on launch. Both are safe with Xcode closed, though they are rarely where the big numbers are.

8. Archives, last and by hand

~/Library/Developer/Xcode/Archives is not a cache. Every Product → Archive creates an .xcarchive holding the built app and its dSYM files. Xcode will not regenerate those. Delete the archive for a build that is live on the App Store and you lose the easy path to symbolicated crash logs for that version.

Open Window → Organizer, look at the dates, and remove archives for builds nobody runs anymore. Keep the archives (or at least the dSYMs) for every version still installed on users' devices. This is the one folder on the page where a mistake is permanent.

Additional components and platform runtimes

Apple's documentation for additional Xcode components says you install only what you use and remove the rest. Choose Xcode → Settings and click Components. The page lists three groups, and it shows how much storage you can recover by removing what is installed:

To download one, click Get. To remove it, click the information button and choose Delete, or Turn Off when the component disables instead of uninstalling. Previously released runtimes are under Other Installed Platforms: click Add Platforms, filter by platform, then Download & Install. A project whose platform has no runtime also shows a Get button next to the run destination.

The same documentation covers Terminal downloads with xcodebuild. A platform download, and a download of every platform that version of Xcode supports:

xcodebuild -downloadPlatform iOS xcodebuild -downloadAllPlatforms

-downloadPlatform takes iOS|watchOS|tvOS|visionOS. Add -buildVersion for one OS version, and -architectureVariant universal when you need the variant that runs on both Apple silicon and Intel. Apple says the default is an Apple silicon variant on Apple silicon, to save disk space, and a universal variant on Intel or when you use Rosetta run destinations. xcodebuild -runFirstLaunch installs required system components, including simctl.

To list runtimes already on the Mac, and to delete one by its identifier instead of digging through system folders:

xcrun simctl runtime list xcrun simctl runtime delete <identifier>

Save a runtime before you delete it

If you may want that runtime back, save the package before you delete it. Apple's component docs say you can download a platform once and install it on another Mac. The same package is a local copy you can import later, without downloading it again.

xcodebuild -downloadPlatform iOS -exportPath ~/Downloads xcodebuild -downloadPlatform iOS -exportPath ~/Downloads -buildVersion 18.0 xcodebuild -importPlatform "~/Downloads/watchOS 9 beta Simulator Runtime.dmg"

-downloadPlatform takes iOS|watchOS|tvOS|visionOS, and -exportPath writes the package to that folder instead of only installing it. Add -buildVersion for one OS version. The version number and the watchOS disk image are the examples in Apple's docs. -importPlatform takes the package you already have. Select the Xcode you want with xcode-select -s first, and run xcodebuild -runFirstLaunch if simctl is not installed yet. That is the order the docs give.

If you did not keep a package, getting the runtime back means downloading it again. Run xcrun simctl delete unavailable afterwards so devices that pointed at the removed runtime go too. Do not delete runtime files by hand.

What usually works

SituationLikely causeFirst move
The next build spends a long time fetching packagesSourcePackages/checkouts went with DerivedDataLet the resolve finish. The project's package dependencies were not in that folder
Clean Build Folder freed almost nothingIndex and caches untouchedProduct → Delete Derived Data… in Xcode 27, or quit Xcode and delete DerivedData contents
DerivedData is big even after clearingCompilationCache.noindex refillingMeasure it separately; expect it to return as you build
Free space dropped after an Xcode upgradeOld and new simulator runtimes side by sideSettings → Components, delete runtimes you do not test against
iOS DeviceSupport is largeOne copy per device OS version you ever connectedDelete versions older than your current devices
Hundreds of simulators in the run menuLeftover devices from old runtimesxcrun simctl delete unavailable
Archives holds years of buildsEvery release you ever shippedReview in Organizer; keep dSYMs for live versions
System Data still huge after all thisNot XcodeRead the system data guide

What not to do

Prevention that is not a cleaner upsell

DerivedData will grow back. That is how it is supposed to work, so plan on clearing it every few months rather than once.

Doing it with an app

Purge can list the Xcode caches above and move the safe ones to the Trash. It does not remove simulator runtimes. A simulator it deletes is gone for good, not sent to the Trash. DeviceSupport and Archives are left for you to check first. You can do every one of these steps by hand. How this differs from a paid suite is in the CleanMyMac alternative.

Frequently asked questions

Does deleting DerivedData delete my code?

No. DerivedData holds build products, intermediates, the code index, logs, and the resolved Swift package checkouts under SourcePackages. Your source files, Git history, project and workspace files, and signing settings live elsewhere. The cost is one slow full build, a re-index, and a fresh checkout of those packages.

How often should I clear Xcode DerivedData?

Only when you need the space or a build misbehaves. It grows back by design, so clearing it every few months on a small SSD is reasonable. Clearing it before every build just makes every build slow.

Why is DerivedData so big?

Every project you have opened keeps its own build products and index, old projects never clean themselves up, and the shared ModuleCache.noindex and CompilationCache.noindex folders grow with every build. Measure per-project sizes with du to see which ones matter.

Is CompilationCache.noindex safe to delete?

Yes, with Xcode quit. It is the on-disk store for Xcode's opt-in compilation cache, described in the Xcode 26 release notes, not your source. Deleting it drops cached compilation results. The next build of a project that has Enable Compilation Caching turned on does that work again, and the folder can refill.

Can I move DerivedData to an external drive?

Yes. Set a custom Derived Data location in Xcode's Settings under Locations, and Xcode writes there from the next build. Do not symlink ~/Library/Developer to another volume; let Xcode manage the path.

How do I tell which DerivedData folder is which project?

Each project folder contains info.plist. The WorkspacePath key is the project or workspace that folder belongs to. Print it with plutil -extract WorkspacePath raw on that file. The command only reads the plist.

Can I reinstall a simulator runtime without downloading it again?

Yes, if you saved the package first. Apple's component documentation shows xcodebuild -downloadPlatform with -exportPath to write the runtime to a folder, and xcodebuild -importPlatform to install that saved package later.

Sources