What Xcode Leaves on Your Mac, and Which Parts Are Safe to Delete
DerivedData, DeviceSupport, simulators and archives look alike in Finder. They behave nothing alike when you delete them.
DerivedData, DeviceSupport và Simulator: Xcode để lại gì trên máy Mac, xoá được đến đâu
Xcode is generous with your disk. Every project you open, every iPhone you plug in, every simulator you boot leaves something in ~/Library/Developer, and none of it is cleaned up when the project ends. After a year of iOS work, that folder can be larger than the apps you built.
The folders look alike: big, oddly named, full of hashes. The mistake is to treat them alike. Some are pure cache, some come back only with a download, and one of them is a record you may need the day a crash report arrives. The question that sorts them is the same one we use everywhere: if I remove it, does it come back on its own?
Start by seeing the sizes. This only reads:
du -hd1 ~/Library/Developer/Xcode ~/Library/Developer/CoreSimulator 2>/dev/null | sort -hHere are the five things you’ll find, from the easiest to the one to keep.
1. DerivedData
Difficulty1 of 5
DerivedData is where Xcode puts intermediate build products, the index that powers autocomplete and jump-to-definition, and build logs. The default location is ~/Library/Developer/Xcode/DerivedData, and Xcode › Settings › Locations shows it, with an arrow that opens it in Finder.
du -hd1 ~/Library/Developer/Xcode/DerivedData 2>/dev/null | sort -h | tail -10Each folder is named after a project plus a random string. Folders for projects you deleted or haven’t touched in months are the obvious ones to clear. Quit Xcode, select them in Finder and move them to the Trash. Xcode rebuilds what it needs the next time you build, so the cost is time, not data.
Product › Clean Build Folder (Shift-Command-K) is a different, smaller tool: it cleans the build products of the open project only. It won’t touch the other ninety folders.
DerivedData is a cache with a long name. Clear it freely, with Xcode closed.
2. iOS DeviceSupport
Difficulty2 of 5
The first time you connect an iPhone or iPad to Xcode, it copies debugging support files for that exact iOS version into ~/Library/Developer/Xcode/iOS DeviceSupport. One folder per version, often a few gigabytes each, and they pile up with every update your test devices take.
du -hd1 ~/Library/Developer/Xcode/iOS\ DeviceSupport 2>/dev/nullFolders for versions your devices no longer run are a clean case. If you ever connect a device on that version again, Xcode copies the files again. Keep the folder for the version on the phone in your pocket, so your next debug session doesn’t start with a wait.
Old iOS versions on your disk support phones you don’t have.
3. Simulator devices
Difficulty3 of 5
Every simulated iPhone you create is a folder in ~/Library/Developer/CoreSimulator/Devices, with its own installed apps, data and settings. This is where the second star turns into a third: deleting a simulator deletes the test data inside it. If you keep a simulator logged in to a test account, or with a carefully seeded database, that’s gone too.
The clean case is simulators your current Xcode can’t even run, because their runtime is gone. List them first; this only reads:
xcrun simctl list devices unavailableTo remove those, xcrun simctl delete unavailable deletes exactly that list. For any other simulator, use Window › Devices and Simulators in Xcode, where you can see its name before you delete it. Don’t drag device folders to the Trash by hand.
A simulator is a small phone. Delete the ones that can’t boot, and look before deleting the rest.
4. Simulator runtimes
Difficulty4 of 5
The runtimes are the simulated operating systems themselves: iOS 18, iOS 26 and so on. They’re several gigabytes each and live outside your home folder as managed disk images, which is why they often surprise people looking at System Data.
Apple’s supported place to manage them is Xcode › Settings › Components. It lists installed runtimes with the storage you can recover; click the info button next to one and choose Delete. From Terminal, this lists them without changing anything:
xcrun simctl runtime listA removed runtime comes back only as a download, often large, and only if Apple still offers it. Remove the versions you no longer support, keep the ones in your deployment range.
Runtimes come back only as a download. Keep the ones you still ship for.
5. Archives: the folder that looks like junk
Difficulty5 of 5
~/Library/Developer/Xcode/Archives is the one folder in this list that is big, old, full of dated subfolders, and still alive. Every time you choose Product › Archive, Xcode stores the build along with its debug symbols (dSYM files).
Those symbols are what turn a crash report from a user’s phone into a readable stack trace. Apple’s documentation on debugging information is clear that you need the dSYM of the exact build that crashed. Delete the archive of a version people still run, and the next crash report from that version becomes a list of memory addresses.
Manage archives from Window › Organizer, where you can see which version each one is. Test builds you never distributed are fair game. Shipped versions that are still installed somewhere are not.
An archive of a shipped build is a receipt, not a leftover.
Conclusions
The five folders line up neatly once you ask what happens after you remove them:
- DerivedData comes back on the next build.
- DeviceSupport comes back the next time that iOS version connects.
- Simulator devices come back empty, without their test data.
- Runtimes come back only as a large download.
- Archives don’t come back at all.
The further a folder is from “comes back on its own”, the more it deserves a look before it goes.
Clear the first two freely, the next two with Xcode open, and the last one almost never. If you’d like that sorting done for you across every project on your Mac, Haikos Clean lists Xcode’s folders with a plain note on whether each one rebuilds, and moves only what you pick to the Trash first. For the bigger picture, start with Your Mac Looks Clean. Until You Ask One Question.
Questions people ask
Is it safe to delete Xcode DerivedData?
Yes. DerivedData holds intermediate build products, indexes and logs that Xcode creates for each project, and Xcode recreates whatever it needs on the next build. Quit Xcode first, then move the folders to the Trash. The only cost is a slower first build and a fresh index the next time you open each project.
Where is DerivedData on a Mac?
By default it is ~/Library/Developer/Xcode/DerivedData, with one folder per project named after the project plus a random suffix. Xcode shows the location in Xcode › Settings › Locations, next to Derived Data, with a small arrow that opens the folder in Finder. Teams sometimes move it, so check that setting if the folder looks empty.
Should I delete Xcode Archives to free up space?
Only archives you are sure you will never need. An archive of a build you shipped holds its debug symbols, which Xcode uses to turn crash reports from that version into readable stack traces. Keep archives for versions people still run. Archives of test builds you never distributed are much safer to remove, from Xcode’s Organizer.
Sources
Paths and commands were checked against these pages on the date above.