Where Xcode’s space actually goes
The Xcode app in your Applications folder is several gigabytes on its own. That part is fixed. The rest lives in your user Library and grows every time you build, run a simulator or connect a device.
| What it is | Where it lives | Safe to delete? |
|---|---|---|
| DerivedData | ~/Library/Developer/Xcode/DerivedData | Safe. Xcode rebuilds it on the next build |
| Simulator devices | ~/Library/Developer/CoreSimulator/Devices | Safe for devices you don't use |
| Simulator runtimes | Xcode Settings, Components | Safe for iOS versions you don't test on |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | Safe for old iOS versions |
| Archives | ~/Library/Developer/Xcode/Archives | Keep any build you still need to debug |
| Xcode caches | ~/Library/Caches/com.apple.dt.Xcode | Safe. Quit Xcode first |
On macOS, Storage settings counts most of this as Developer or System Data, which is why a grey bar can grow by tens of gigabytes without an obvious cause.
Measure before you delete
Spend a minute finding the biggest folder first. Open Terminal and run:
du -sh ~/Library/Developer/Xcode/*du -sh ~/Library/Developer/CoreSimulator
Each line shows a folder and its size. Start your cleanup with whichever is largest. You can also open ~/Library/Developer in Finder with Shift-Command-G and turn on Calculate all sizes in View Options.
6 ways to free up space from Xcode
Quit Xcode and the Simulator app before you start.
1. Delete DerivedData
DerivedData holds the build products, indexes and logs for every project you have ever opened. Projects you deleted months ago still have folders here.
- In Finder, press Shift-Command-G and go to
~/Library/Developer/Xcode/DerivedData. - Select everything inside and move it to the Trash.
- Empty the Trash.
Xcode recreates what it needs on your next build, which takes longer than usual once. For a single project, Product, then Clean Build Folder, is the gentler option, though it frees less.
2. Remove simulators you don’t use
Every simulator device keeps its own apps and data. Old devices from past Xcode versions often linger after their runtime is gone.
- In Terminal, run
xcrun simctl delete unavailable. This removes devices whose runtime is no longer installed. - For the rest, open Xcode, choose Window, then Devices and Simulators, click Simulators, right-click a device you don’t use and choose Delete.
Reset rather than delete
If a simulator you still use has grown large, reset it instead. Run xcrun simctl erase all to wipe the data on every simulator while keeping the devices themselves.
3. Remove old simulator runtimes
Runtimes are the biggest single items, often several gigabytes each. You need one only for the iOS, watchOS, tvOS or visionOS versions you actually test on.
- Open Xcode, choose Xcode, then Settings, then Components. Older versions call this tab Platforms.
- Select a runtime you no longer need.
- Click the minus button and confirm.
From Terminal, xcrun simctl runtime list shows installed runtimes with their IDs, and xcrun simctl runtime delete followed by an ID removes one. Some runtimes disappear only after a restart, so check again after you reboot.
4. Clear old iOS DeviceSupport files
Each time you connect an iPhone running a new iOS version, Xcode copies debug symbols for it. Over a few years you can collect a folder for every point release you ever ran.
Go to ~/Library/Developer/Xcode/iOS DeviceSupport and delete folders for iOS versions your devices no longer use. Keep the newest. Xcode recreates any folder it needs when you next connect a device. The same applies to the watchOS DeviceSupport folder if you have one.
5. Prune old archives
Every time you archive a build to upload or export it, Xcode keeps a copy, debug symbols included. Open Xcode, choose Window, then Organizer, and review the Archives list. Delete builds for versions you no longer support. Read the next section first.
6. Clear Xcode and Swift package caches
Xcode keeps a general cache at ~/Library/Caches/com.apple.dt.Xcode, and Swift Package Manager keeps downloaded packages at ~/Library/Caches/org.swift.swiftpm. Both are safe to empty with Xcode closed. Packages download again the next time a project resolves them.
The Storage settings shortcut
macOS also offers a quick route. Open System Settings, then General, then Storage, and click the info button next to Developer. It lists Xcode caches, build files and some simulator data with their sizes, and you can delete them from there. It doesn’t show archives or runtimes, so use the steps above for a full cleanup.
What to keep, even when space is tight
Archives for live releases
An archive holds the dSYM files that turn crash reports into readable stack traces. If users still run a version, keep its archive, or export its dSYMs somewhere safe first.
The runtime for your deployment target
Keep at least one runtime that matches the oldest iOS version you support, plus the current one. Without them, you can’t test the versions your users run.
Anything inside /System or /Library you didn’t create
Some simulator runtimes live in protected system folders. Remove them through Xcode or simctl, never by deleting folders with administrator rights. Forcing it can leave Xcode unable to find the runtimes you kept.
If something breaks after a cleanup
None of the steps above touch your source code, but a few things can look odd the first time you open Xcode.
The first build is slow
That is expected after you clear DerivedData. Xcode rebuilds every module and reindexes the project once. Later builds return to normal speed.
Autocomplete or jump-to-definition stops working
Indexing runs in the background after a cleanup. Give it a few minutes. If it stays broken, quit Xcode, clear DerivedData for that project again and reopen it.
A simulator you need has gone
Open Xcode, then Settings, then Components, and download the runtime again. Then add a device in Devices and Simulators. Your project and its code are unaffected.
Packages fail to resolve
Choose File, then Packages, then Reset Package Caches, and let Xcode download them again.
Do you have more than one copy of Xcode?
Beta testers often keep a release Xcode and a beta side by side. Each copy is several gigabytes, and each one downloads its own components. Check Applications for apps named Xcode-beta or with a version number, and delete the ones you have finished with.
If you also work on web projects, look for old node_modules folders too. Projects you haven’t touched in months can hold hundreds of megabytes each, and npm install brings them back whenever you need them.
Keep Xcode lean from now on
- Clear DerivedData every month or two, and whenever builds act strangely.
- Remove the previous runtime once you drop support for that iOS version.
- Run
xcrun simctl delete unavailableafter every major Xcode update. - Review the Organizer when you ship a release and drop archives you no longer need.
If Xcode isn’t the whole story, our guide on how to free up space on a Mac covers the rest of the disk.
Clean developer files in one scan with MyMacStorage
MyMacStorage has a Developer files tool built for this job. It scans locally, so your project names never leave your Mac, and it moves everything to the Trash rather than deleting it. It costs $14.99 once, with no subscription. Learn more on the home page.