TheCleanDisk

How to clear Xcode DerivedData and other developer files safely

Updated · 7 min read · By the TheCleanDisk team

Short answer

Xcode keeps build data in ~/Library/Developer/Xcode/DerivedData. It is safe to delete: Xcode rebuilds it, so your next build just takes longer. Other big, rebuildable developer files are device support folders for old iOS versions, unavailable simulators, simulator runtimes you don't use, and package manager caches. Be careful with Xcode Archives, which hold the debug symbols for apps you have shipped.

1. Delete DerivedData

DerivedData holds build products, indexes and logs for every project you have opened. Quit Xcode, then either open Xcode › Settings › Locations and click the arrow next to the DerivedData path, or run:

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

Your projects and source code are not touched. Deleting DerivedData is also a common fix for odd build errors.

2. Remove device support for old iOS versions

When you connect a device, Xcode copies its debug symbols to ~/Library/Developer/Xcode/iOS DeviceSupport (with similar folders for watchOS and other platforms). Each version can take several gigabytes. Delete folders for versions you no longer debug; Xcode copies them again if you connect a device running that version.

3. Clean up simulators and runtimes

Remove simulators that belong to runtimes you no longer have installed:

xcrun simctl delete unavailable

Simulator runtimes themselves are large. In recent versions of Xcode, manage them in Xcode › Settings › Components, or list them in Terminal with xcrun simctl runtime list and delete the ones you don't need.

4. Clear SwiftUI preview data

Previews keep their own simulator data in ~/Library/Developer/Xcode/UserData/Previews. It is rebuilt the next time you open a preview.

5. Clear package manager caches

These caches only speed up downloads, and each tool has its own command:

The next install or build downloads what it needs again.

6. Be careful with Archives

~/Library/Developer/Xcode/Archives holds the builds you exported or uploaded, including their dSYM debug symbols. You need those to read crash reports from released versions. Delete old archives only for versions nobody uses anymore, or copy them to another drive first. In Xcode, manage them in Window › Organizer.

7. Local AI models

Tools that run AI models on your Mac can store several gigabytes per model, usually in a hidden folder in your home folder or in Application Support. Remove models from inside the tool you downloaded them with, so it stays in sync.

Where TheCleanDisk helps

TheCleanDisk has a Dev Tools section that finds DerivedData, device support, simulators and package caches, shows which projects still exist, and marks rebuildable data as Safe. Everything goes to quarantine first, so you can undo for 7 days. The space is fully freed when quarantine empties, or sooner if you empty it yourself. It is coming soon to the Mac App Store.

Common questions

Will deleting DerivedData break my Xcode project?

No. DerivedData only holds build products, indexes and logs. Xcode recreates it on the next build, which takes longer the first time.

Is it safe to delete iOS DeviceSupport folders?

Yes, for iOS versions you no longer debug. Xcode copies the symbols again the next time you connect a device running that version.

Should I delete Xcode Archives?

Only for app versions you no longer support. Archives contain the debug symbols needed to read crash reports, so keep the ones for versions people still use.