Why Xcode Takes So Much Storage (And How to Clear It)
Xcode fills a disk with build data, simulators, archives and device support files. Here is where each one lives and how to clear it safely by hand.
Xcode takes so much storage because it keeps four kinds of data under ~/Library/Developer and almost never removes them itself: build products in DerivedData, simulator runtimes and devices, archives of every build you have distributed, and support files for each device you have plugged in. All four can be cleared by hand, and Xcode makes again whatever it still needs. On a Mac that has built many projects over a few years, these folders together can reach tens of gigabytes.
Step 1: Measure the folders first
Open Terminal and run:
du -sh ~/Library/Developer/Xcode/* ~/Library/Developer/CoreSimulator
The command prints the size of each folder and changes nothing. Start with the largest one. For most people that is DerivedData or CoreSimulator.
Step 2: Delete DerivedData
DerivedData holds build products, indexes and module caches for every project you have opened. It lives at ~/Library/Developer/Xcode/DerivedData, and it is the safest of the four to remove.
- Quit Xcode.
- In Finder choose Go > Go to Folder and enter
~/Library/Developer/Xcode/DerivedData. - Select everything inside and move it to the Trash.
- Empty the Trash.
You can also find the folder from Xcode > Settings > Locations, where the arrow beside the Derived Data path opens it in Finder. The cost is time: the next build of each project is a full build, the index is made again and Swift packages are resolved again.
Step 3: Remove simulators you do not use
Simulator data lives in ~/Library/Developer/CoreSimulator. Do not delete files in that folder by hand, because Xcode keeps its own record of what is there. Use Xcode and its command line tool instead.
- In Terminal, run
xcrun simctl delete unavailable. It removes simulator devices whose runtime is no longer installed. - Run
xcrun simctl list devicesto see what is left. - In Xcode, open Window > Devices and Simulators, choose the Simulators tab and delete the devices you never launch.
- To remove a whole runtime, such as an older iOS version, open Xcode > Settings and choose Platforms (named Components in newer versions of Xcode). Select the runtime and delete it.
Keep the runtimes that match the oldest and newest system versions your app supports. A runtime you delete can be downloaded again from the same screen.
Step 4: Clear out old archives
Each time you choose Product > Archive, Xcode saves the result in ~/Library/Developer/Xcode/Archives.
- In Xcode, open Window > Organizer and choose Archives.
- Pick an app, then select the archives you no longer need.
- Right-click and choose Delete.
Be more careful here than with DerivedData. An archive holds the debug symbols for that exact build, and you need them to read crash reports from it. Keep the archives of versions people are still using, and delete test builds and versions long since replaced.
Step 5: Trim device support files
When you connect an iPhone or iPad, Xcode copies symbol files for that device's system version into ~/Library/Developer/Xcode/iOS DeviceSupport. There is one folder for each combination of device and system version, so the folder grows with every update you install on a test device.
- Quit Xcode.
- Open the folder with Go > Go to Folder in Finder.
- Move the folders for system versions you no longer run to the Trash.
If you guess wrong, nothing is lost. Xcode copies the files again the next time that device is connected, which takes a few minutes. If you build for Apple Watch or Apple TV, the matching folders sit beside this one.
What MacPrune does about Xcode data
MacPrune does not replace the steps above. It finds the data and shows its size next to everything else on the disk. In MacPrune v2.0:
- Clean runs one scan, and Xcode data is one of the categories in the Safe to clean group, beside package manager caches, user caches and system logs.
- Disk draws a map where each folder is a tile sized by the space it takes, so you can see how large your Developer folder is against the rest of your files. Nothing is deleted from the map.
- Large Files lists files above a size you set, biggest first.
What you choose is moved to the Trash after you confirm, and the space is freed when the Trash is emptied. The free version scans everything, so you can see what Xcode data adds up to, and it cleans user caches, browser caches and the Trash. Cleaning the Xcode data category is part of Pro, which is a single purchase with no subscription.
Keep it from growing back
Xcode fills these folders again as you work, so repeat the steps every few months: run xcrun simctl delete unavailable after each Xcode update, delete DerivedData when a project is finished, and prune archives after each release.
To see the whole disk in one view, download MacPrune, or check what Pro includes on the pricing page. For the rest of the disk, read how to free up storage on your Mac, how to clear System Data and Mac storage full but nothing to delete.
Written by MacPrune Team
Building MacPrune, the smartest Mac storage cleaner. Free, safe, and private.
Try MacPrune for free
Reclaim gigabytes of wasted disk space with one click. No subscription, no data collection.