Xcode is using 60 GB. Here is what you can delete

If Xcode is installed, it is almost certainly the largest thing on your disk. Nearly all of it regenerates.

Xcode itself is around 15 GB. What it writes afterwards is usually larger, and unlike most disk usage, nearly every byte of it can be deleted with no consequence beyond a slower next build.

Start with the survey:

du -sh ~/Library/Developer/Xcode/DerivedData
du -sh ~/Library/Developer/Xcode/iOS\ DeviceSupport
du -sh ~/Library/Developer/Xcode/Archives
du -sh ~/Library/Developer/CoreSimulator
du -sh ~/Library/Caches/com.apple.dt.Xcode

Anything absent prints an error, which just means you do not have it.

DerivedData

Build products, indexes and module caches, one folder per project, kept forever including for projects you deleted two years ago.

rm -rf ~/Library/Developer/Xcode/DerivedData/*

Cost: the next build of each project is a full one. That is the entire downside, and it is also the reason “delete DerivedData” is the first thing anyone suggests when Xcode misbehaves — it fixes phantom build errors, stale autocomplete and a good share of “clean build folder did not help”.

Delete this one without thinking about it.

iOS DeviceSupport

Every time you connect a device running an iOS version Xcode has not seen, it copies that version’s symbol files across. Each is 2–6 GB, they are kept forever, and there is one per iOS build number — not per major version.

du -sh ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

Everything except the versions you currently debug against can go. If you plug that device in again, Xcode re-copies what it needs, which takes a few minutes.

The same pattern exists for other platforms, at watchOS DeviceSupport and tvOS DeviceSupport.

Simulators

Two separate things live here, and only one is safe to remove casually.

Simulator devices are the individual simulated iPhones, each with its own disk image containing whatever you installed on it. They accumulate, particularly across Xcode upgrades, and ones belonging to runtimes you no longer have installed are pure waste. There is a command for exactly that set:

xcrun simctl delete unavailable

That deletes only simulators whose runtime is gone. It is safe, and it frequently frees several gigabytes.

To go further and reset everything to a clean state:

xcrun simctl delete all

That removes every simulator including ones you use. Xcode recreates the defaults, but anything you had installed on them is gone.

Simulator runtimes are the OS images themselves, several gigabytes each. Manage them from Xcode → Settings → Components rather than by hand.

Archives

Every time you archive a build for distribution, the result is kept, with its dSYM debug symbols.

du -sh ~/Library/Developer/Xcode/Archives/*

Do not blanket-delete these. The dSYM files inside are what turn a crash report from a shipped build into readable line numbers. If you have shipped a version to users, keep its archive for as long as you might need to symbolicate a crash from it.

Archives from builds that never left your machine are fine to remove.

The caches

rm -rf ~/Library/Caches/com.apple.dt.Xcode/*

Safe, and worth doing when Xcode is behaving oddly. Quit Xcode first.

Old Xcode versions

If you have kept multiple Xcodes around, each is 15 GB or so. Check:

ls -d /Applications/Xcode*.app

And the command line tools, which are separate and can also be reinstalled at any time with xcode-select --install:

du -sh /Library/Developer/CommandLineTools

Doing the lot

For a developer machine that has never been cleared, this sequence typically frees 30–60 GB:

rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
xcrun simctl delete unavailable

Then review DeviceSupport and Archives by hand, since those are the two where you might actually want to keep something.

Quit Xcode before running any of it. The first build afterwards will be slow, and everything else will be as it was.