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 Package dependencies usually land in a SourcePackages folder inside the project's entry.
There are also shared caches beside the project folders:
ModuleCache.noindexholds precompiled modules shared across projects.CompilationCache.noindexis the newer compilation cache. Xcode 26 added compilation caching as an opt-in feature to speed up branch switches and clean builds.
That second one has become a common surprise. A thread on r/iOSProgramming titled "Xcode 26: CompilationCache.noindex using 26 GBs of storage" describes it filling back up to the same size after being cleared. Treat it like the rest of DerivedData: safe to delete, and likely to grow back if you keep building the same projects.
Reports of total size vary a lot. The original Stack Overflow question on this topic started with a 22 GB DerivedData folder. An Ask Different answer on "Project Build Data and Indexes" puts it bluntly: some projects take 50 kB, some take 50 GB. No average will tell you what yours holds, so measure it (below).
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.
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/Developeroften 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.
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/Caches/com.apple.dt.Xcode 2>/dev/nullTo see which projects inside DerivedData are the heavy ones:
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -hIn 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.
2. Delete DerivedData
Pick one:
- 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:
rm -rf ~/Library/Developer/Xcode/DerivedData/*The Terminal version skips Trash, so double-check the path. It does not need 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.
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. 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.
5. 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. Do not hunt for them in Finder. Use Xcode → Settings → Components. Apple's documentation says that screen shows how much storage you can recover. Click the information button next to a runtime and choose Delete.
From Terminal, the same job is:
xcrun simctl runtime list
xcrun simctl runtime delete <identifier>Getting a runtime back means downloading it again. Run xcrun simctl delete unavailable afterwards to clear devices that pointed at it.
6. 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.
7. 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.
What usually works
| Situation | Likely cause | First move |
|---|---|---|
| Clean Build Folder freed almost nothing | Index and caches untouched | Quit Xcode, 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.
Where a careful cleaner fits
Once you know which buckets are regenerable, the remaining chore is visiting the same paths every few months. Purge is an open-source Mac cleaner that can list those Xcode items for you and move them to Trash.
It only offers allowlisted paths. DerivedData, CoreSimulator caches, the Documentation cache, and Xcode's app cache are marked Safe. DeviceSupport, Archives, and shut-down simulator devices are marked Check First, because each one costs you something. Purge does not remove simulator runtimes. That stays with Settings → Components or simctl. There is no telemetry, and you can read the code on GitHub.
Use Organizer and Components for the decisions that are hard to undo. Use Purge for the named junk you already understand.
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, deleting components): 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
- 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