How to delete Xcode DerivedData (and other Xcode space hogs)
If you develop for Apple platforms, Xcode is probably one of the biggest users of space on your Mac, and most of it is hidden in ~/Library/Developer. Here's what each part is and how to clear it.
Short answer: Quit Xcode and run rm -rf ~/Library/Developer/Xcode/DerivedData. Xcode rebuilds it on the next build. Then delete old device support folders and run xcrun simctl delete unavailable. Be careful with Archives: keep the ones you shipped.
What's using the space
| Folder | What it is | Safe to delete? |
|---|---|---|
~/Library/Developer/Xcode/DerivedData | Build products, intermediate files and indexes for every project you've opened | Yes. Rebuilt on the next build. |
~/Library/Developer/Xcode/iOS DeviceSupport | Debug symbols copied from each iOS version of each device you've connected | Yes. Copied again when you reconnect a device. |
~/Library/Developer/CoreSimulator/Devices | Simulator devices and the apps and data inside them | Delete unavailable ones with simctl. |
~/Library/Developer/CoreSimulator/Caches | Simulator runtime caches | Yes. |
~/Library/Developer/Xcode/Archives | Archived builds you've exported or uploaded | Only old ones. You need an archive's dSYMs to read crash reports from that build. |
Delete DerivedData
From Xcode
Product › Clean Build Folder (Shift-Command-K) only cleans the current project. To clear everything, open Xcode › Settings › Locations and click the small arrow next to the DerivedData path. Finder opens the folder. Quit Xcode, then move the folder's contents to the Trash.
From Terminal
rm -rf ~/Library/Developer/Xcode/DerivedData
Quit Xcode first. This deletes immediately rather than moving to the Trash. The next build of each project takes longer while Xcode rebuilds and re-indexes.
Deleting DerivedData also fixes a lot of strange Xcode problems, like stale autocomplete, "No such module" errors and builds that ignore your changes.
Delete old device support files
Each time you connect a device running a new iOS version, Xcode copies several gigabytes of symbols into ~/Library/Developer/Xcode/iOS DeviceSupport. Folders are named by OS version and build. Delete the ones for versions your devices no longer run. The same goes for the watchOS, tvOS and visionOS folders next to it.
Delete unavailable and unused simulators
Simulators for runtimes you've removed stay on disk. Remove them with:
xcrun simctl delete unavailable
To see how much the runtimes themselves use, and to delete old ones, open Xcode › Settings › Components (called Platforms in some versions) or run xcrun simctl runtime list. Simulator runtimes are often 5–8 GB each.
To reset every simulator's apps and data without deleting the devices, run xcrun simctl erase all with the Simulator app closed.
Clean up archives carefully
Archives in ~/Library/Developer/Xcode/Archives are organized by date. Open Window › Organizer to see them by app and version. Keep archives for builds that are live in the App Store or with testers, because their debug symbols are what turn crash reports into readable stack traces (unless you've uploaded symbols elsewhere). Old development archives can go.
Other developer caches
If you use other toolchains, these also grow large and are safe to clear (packages download again when needed):
- npm:
npm cache clean --force(or delete~/.npm/_cacache) - Yarn, pnpm and Bun:
yarn cache clean,pnpm store prune,bun pm cache rm - Gradle:
~/.gradle/caches - Cargo:
~/.cargo/registry/cache - Homebrew:
brew cleanup - Swift Package Manager:
~/Library/Caches/org.swift.swiftpm
Common questions
Is it safe to delete Xcode DerivedData?
Yes. DerivedData only holds build products and indexes that Xcode regenerates. The next build of each project will take longer.
Where is DerivedData on a Mac?
By default it is at ~/Library/Developer/Xcode/DerivedData. You can confirm the location in Xcode › Settings › Locations.
Can I delete iOS DeviceSupport folders?
Yes. Xcode copies the symbols again the next time you connect a device running that iOS version. Delete folders for versions your devices no longer run.
Do this in a few clicks with Reclaim
Reclaim is a small Mac app that finds caches, logs, Xcode build data, old installers, large files and leftovers from deleted apps. It sorts them by how safe they are to remove, and moves things to the Trash only after you confirm. One-time purchase from $5.
See Reclaim