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.noindexModuleCache.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/nullTo see which projects inside DerivedData are the heavy ones:
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -hWhich 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"
doneplutil -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:
- In Xcode 27, choose Product → Delete Derived Data… and confirm. Apple's WWDC26 Xcode lab describes it as the replacement for deleting folders by hand, running Terminal commands, or keeping your own script.
- Settings → Locations, click the arrow next to Derived Data, select the contents in Finder, and move them to Trash.
- System Settings → General → Storage → Developer, then delete "Project Build Data and Indexes".
- In Terminal, with Xcode closed (below).
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 unavailableDevices 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:
~/Library/Developer/Xcode/iOS DeviceSupport~/Library/Developer/Xcode/watchOS DeviceSupport~/Library/Developer/Xcode/tvOS DeviceSupport~/Library/Developer/Xcode/visionOS DeviceSupport(some setups showxrOS DeviceSupport)
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:
- Platform support: the platforms you can build apps for.
- Other components: optional features you can turn on or off, including the Metal toolchain.
- Other installed platforms: simulator runtimes for device types and OS versions.
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
| Situation | Likely cause | First move |
|---|---|---|
| The next build spends a long time fetching packages | SourcePackages/checkouts went with DerivedData | Let the resolve finish. The project's package dependencies were not in that folder |
| Clean Build Folder freed almost nothing | Index and caches untouched | Product → Delete Derived Data… in Xcode 27, or quit Xcode and delete DerivedData contents |
| DerivedData is big even after clearing | CompilationCache.noindex refilling | Measure it separately; expect it to return as you build |
| Free space dropped after an Xcode upgrade | Old and new simulator runtimes side by side | Settings → Components, delete runtimes you do not test against |
iOS DeviceSupport is large | One copy per device OS version you ever connected | Delete versions older than your current devices |
| Hundreds of simulators in the run menu | Leftover devices from old runtimes | xcrun simctl delete unavailable |
Archives holds years of builds | Every release you ever shipped | Review in Organizer; keep dSYMs for live versions |
| System Data still huge after all this | Not Xcode | Read the system data guide |
What not to do
- Do not delete all of
~/Library/Developer. As one Ask Different answer lists, it also holds Archives, your color themes and key bindings inUserData, and custom project templates. The cache folders are safe to clear one by one. The parent folder as a whole is not. - Do not treat Archives as cache, and do not let any tool trash them without you reviewing each one.
- Do not use
sudo rm -rfon anything in this guide. - Do not delete files from Finder while Xcode is building or indexing.
- Do not remove simulator runtimes by digging through system folders. Components and
simctlexist for that. - Do not confuse iOS Files in Storage (iPhone and iPad backups) with DeviceSupport. Backups are your data. DeviceSupport is a symbol cache.
- Do not symlink
~/Library/Developerto an external drive to save space. If you want build data elsewhere, set a custom Derived Data or Archives location in Settings → Locations and let Xcode handle the path.
Prevention that is not a cleaner upsell
- After each major Xcode update, open Settings → Components and remove runtimes you will not test against. The screen shows the recoverable size next to each one, so it takes a minute.
- Keep one simulator per OS and device class you actually test. More is clutter.
- Decide how long you keep Archives, for example the current release and the one before it, plus dSYMs for anything still in use.
- If DerivedData keeps filling a small internal SSD, point it at a fast external or secondary volume in Settings → Locations.
- Leave real headroom on 256 GB and 512 GB Macs. Builds and Xcode updates need scratch space, and running near zero makes everything slower.
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
- Apple, Xcode 26 Release Notes (DerivedData cleanup workaround; compilation caching): developer.apple.com/documentation/xcode-release-notes/xcode-26-release-notes
- Apple, Downloading and installing additional Xcode components (Settings → Components, platform support, simulator runtimes,
xcodebuild -downloadPlatform -exportPath,xcodebuild -importPlatform): developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components - Apple, Xcode Help, Download and install simulator runtimes: help.apple.com/xcode/mac/current/en.lproj/deva7379ae35.html
- Apple, WWDC26 Xcode Tips and Tricks Group Lab (Product → Delete Derived Data… in Xcode 27): developer.apple.com/videos/play/wwdc2026/8013
- Apple,
trash(8)manual page, macOS 15 and later (History: first appeared in macOS 15.0). Read it withman trash. - Apple Developer Forums, Xcode Previews threads using
xcrun simctl --set previews delete all: developer.apple.com/forums/thread/703253 - Apple Developer Forums, Xcode 16.3 DerivedData size problem (CompilationCache.noindex growth): developer.apple.com/forums/thread/779612
- Stack Overflow, Can I safely delete contents of Xcode Derived data folder?: stackoverflow.com/questions/18933321/can-i-safely-delete-contents-of-xcode-derived-data-folder
- Ask Different, Is it safe to erase ~/Library/Developer?: apple.stackexchange.com/questions/104810/is-it-safe-to-erase-library-developer
- Ask Different, How to determine which DeviceSupport is useful: apple.stackexchange.com/questions/400735/xcode-how-to-determine-which-devicesupport-is-useful
- Ask Different, Is 5.45GB normal for Project Build and Index in Xcode?: apple.stackexchange.com/questions/425591/is-5-45gb-normal-for-project-build-and-index-in-xcode
- Apple Developer Forums, Swift package checkouts under DerivedData
SourcePackages/checkouts: developer.apple.com/forums/thread/666137, developer.apple.com/forums/thread/743171 - Stack Overflow, DerivedData
info.plistWorkspacePath: stackoverflow.com/questions/74334611/how-to-modify-info-plist
