How to delete Xcode DerivedData and caches without breaking anything
You can delete ~/Library/Developer/Xcode/DerivedData at any time: Xcode rebuilds it on the next build, so you only lose build time. Old simulators and runtimes are best removed with xcrun simctl or Xcode settings. Be careful with Archives, because they hold the dSYM files you need to read crash reports.
If you build iOS or macOS apps, Xcode slowly fills your disk with build data, simulator devices, simulator runtimes and device symbols. Most of it is cache that Xcode can rebuild. Some of it is not. This guide shows each folder, how to measure it, how to clean it, and what you lose.
What takes space in Xcode
These are the main places Xcode writes to, all inside your user folder:
| Folder or item | What it is | Rebuilt automatically? |
|---|---|---|
~/Library/Developer/Xcode/DerivedData |
Build products, intermediate files, indexes and logs per project | Yes, on the next build |
~/Library/Developer/Xcode/Archives |
Archives from Product > Archive, with your dSYM files | No |
~/Library/Developer/Xcode/iOS DeviceSupport |
Debug symbols copied from devices you connected | Yes, when you connect the device again |
~/Library/Developer/CoreSimulator/Devices |
Each simulator device, with its installed apps and data | No, the device and its data are gone |
| Simulator runtimes | The iOS, watchOS, tvOS or visionOS system each simulator runs | You can download them again |
~/Library/Developer/CoreSimulator/Caches |
Caches the simulator creates | Yes, the simulator creates them again |
The key idea: delete freely what is rebuilt, and think before you delete what is not.
Step 1: measure before you delete
Always look first. This command only reads, it doesn’t change anything:
du -sh ~/Library/Developer/Xcode/DerivedData \
~/Library/Developer/Xcode/Archives \
~/Library/Developer/Xcode/"iOS DeviceSupport" \
~/Library/Developer/CoreSimulator/Devices \
~/Library/Developer/CoreSimulator/Caches 2>/dev/null
To see which projects use the most space inside DerivedData:
du -sh ~/Library/Developer/Xcode/DerivedData/* 2>/dev/null | sort -h
Each folder name starts with the project name, followed by a random suffix. If you see projects you deleted months ago, those folders are pure leftovers.
Step 2: delete DerivedData
DerivedData is the safest folder to clean. It only contains data Xcode generates from your project: compiled files, the code index used for autocomplete and search, and build logs.
The lower-risk option first: Clean Build Folder
Inside Xcode, open your project and choose Product > Clean Build Folder (Shift + Command + K). This removes the build products of the open project only. It is a good first step when a build behaves strangely.
Delete the whole folder
If you want the space back for all projects:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
To delete only one project, remove its folder instead, for example rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-abc123. Swift Package Manager dependencies resolved by Xcode also live inside DerivedData, so the next build may download them again.
Step 3: be careful with Archives (dSYM files)
Every time you use Product > Archive, Xcode stores a bundle in ~/Library/Developer/Xcode/Archives. Apple describes an archive as “a build of your app, including debugging information” (Distributing your app). That debugging information is the dSYM file.
Apple is clear about this: you must keep the Xcode archive for each build you distribute, or you might not be able to diagnose crash reports (Building your app to include debugging information).
So the safe rule is:
- Open Window > Organizer > Archives in Xcode.
- Keep the archives of every version that users still run.
- Delete only archives of test builds or versions nobody uses anymore. You can right click an archive and choose Delete, or show it in Finder first.
Step 4: clean simulators
Simulators use space in two ways: devices (the iPhone 16 you created, with its apps and data) and runtimes (the iOS system those devices run).
List what you have
xcrun simctl list devices
xcrun simctl list runtimes
simctl list only reads. Devices marked as unavailable belong to runtimes that are no longer installed or no longer supported.
Delete unavailable devices
According to the built-in help (xcrun simctl help delete), unavailable deletes “devices that are not supported by the current Xcode SDK”.
xcrun simctl delete unavailable
Avoid xcrun simctl delete all unless you really want to remove every simulator device, including the ones you use every day.
Remove simulator runtimes you no longer use
Runtimes are often the biggest item. Apple recommends managing them in Xcode > Settings > Components: Xcode shows each installed component with the storage you can recover, and you remove it with the information button and Delete (Downloading and installing additional Xcode components).
From the terminal, xcrun simctl runtime can do the same. Use --dry-run first to see what would go:
xcrun simctl runtime list
xcrun simctl runtime delete --notUsedSinceDays 90 --dry-run
If the list looks right, run the same command without --dry-run. A deleted runtime can be downloaded again from Settings > Components when you need it, but that takes time and bandwidth.
Step 5: iOS DeviceSupport and CoreSimulator caches
When you connect an iPhone or iPad to debug, Xcode copies debug symbols for that iOS version into ~/Library/Developer/Xcode/iOS DeviceSupport. Every new iOS version adds a new folder, and old ones are never removed for you. You can see them by version:
du -sh ~/Library/Developer/Xcode/"iOS DeviceSupport"/* 2>/dev/null
rm -rf ~/Library/Developer/Xcode/"iOS DeviceSupport"/"<old-version-folder>"
The folder ~/Library/Developer/CoreSimulator/Caches holds caches that the simulator generates. Quit Xcode and the Simulator app before you delete its contents; the next simulator launch will be slower while it rebuilds them.
What is rebuilt and what is not
- Rebuilt by Xcode: DerivedData, iOS DeviceSupport (when you connect the device), CoreSimulator caches.
- Can be downloaded again: simulator runtimes, Swift packages.
- Gone for good: Archives and their dSYM files, simulator devices with their data.
If you only remember one thing: DerivedData is cache, Archives are records.
Common problems after cleaning
- “No such module” or indexing never ends. Normal for the first minutes. Let Xcode finish indexing, then build again.
- Packages fail to resolve. Use File > Packages > Reset Package Caches, then build.
- No simulator to run on. You deleted the device or its runtime. Add a runtime in Settings > Components and a device in Devices and Simulators.
Keep it under control
Run the du -sh command from Step 1 once a month. Delete DerivedData when it grows, clean unavailable simulators after each Xcode update, and review Archives after each release. If you also work with containers or JavaScript, read how to free disk space with docker prune and how to clean node_modules and npm, pnpm and yarn caches. For a full tour of your disk, start with how to free up space on Mac, or download Pruneo for free.
FAQ
Is it safe to delete the DerivedData folder?
Yes. DerivedData holds build products, indexes and logs that Xcode creates again on the next build. Close Xcode first, and expect the first build and indexing to take longer.
Will deleting DerivedData delete my code?
No. Your source code, project files and Git history live in your project folder, not in DerivedData. Only generated build data is removed.
Can I delete Xcode Archives?
Only archives of builds you no longer support. Apple says you must keep the archive for each build you distribute, because it contains the dSYM files used to symbolicate crash reports.
What does xcrun simctl delete unavailable do?
It deletes simulator devices that are not supported by the current Xcode SDK, for example devices tied to a runtime you no longer have installed.