CleanMate

All guides · macOS · Updated

Xcode using too much space: DerivedData, simulators, archives and device support

Where Xcode keeps its gigabytes and what is safe to delete: DerivedData, simulator data and test device clones, old simulator runtimes, archives, iOS DeviceSupport, the documentation cache and CocoaPods spec repos, with the commands.

Download for macOS — free and open source

CleanMate Smart Scan on a Mac, listing Xcode DerivedData, device support and simulator data with their sizesCleanMate Smart Scan on a Mac, listing Xcode DerivedData, device support and simulator data with their sizes

Xcode itself takes about 10 GB in /Applications. What it writes next to your home folder is often five times that. Every project you open leaves build products, every iOS version you plug in leaves debug symbols, and every simulator keeps its own copy of the apps you installed on it. Done with Xcode altogether? See how to uninstall Xcode and the Command Line Tools cleanly.

Almost all of it lives in ~/Library/Developer. Look there first:

du -sh ~/Library/Developer/* ~/Library/Developer/Xcode/* 2>/dev/null | sort -h

Then go through the folders below. Quit Xcode and the Simulator before you delete anything, so nothing is written while you clean. The Terminal does not need Full Disk Access for these folders.

DerivedData

~/Library/Developer/Xcode/DerivedData holds the build products, indexes and logs of every project you opened, one folder per project, plus shared caches such as ModuleCache.noindex. It is the safest big folder on the Mac: Xcode rebuilds it, and you wait for one full build and one re-index.

du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -h
rm -rf ~/Library/Developer/Xcode/DerivedData/<Project-hash>   # one project
rm -rf ~/Library/Developer/Xcode/DerivedData                  # everything

Delete the folders of projects you no longer work on first; they never shrink on their own.

Simulator data and test device clones

Each simulator has a folder in ~/Library/Developer/CoreSimulator/Devices, named by its UDID, with every app you installed and the data they wrote. A simulator you used for a year can hold several GB. Match the folders to names:

xcrun simctl list devices
du -sh ~/Library/Developer/CoreSimulator/Devices/* | sort -h | tail

Erasing a simulator resets it to a fresh device: its apps and data are gone, the simulator stays in Xcode’s list.

xcrun simctl shutdown <UDID>
xcrun simctl erase <UDID>
xcrun simctl delete unavailable      # remove simulators whose runtime is gone

When Xcode runs tests in parallel, it clones simulators into ~/Library/Developer/XCTestDevices. These clones stay after the run. You can delete the folder’s contents with Xcode closed; the next parallel test run makes new ones.

du -sh ~/Library/Developer/XCTestDevices
rm -rf ~/Library/Developer/XCTestDevices/*

SwiftUI Previews keep their own simulators in ~/Library/Developer/Xcode/UserData/Previews, and ~/Library/Developer/CoreSimulator/Caches holds caches the Simulator rebuilds. Both are safe to delete with Xcode closed.

Old simulator runtimes

Since Xcode 14, simulator runtimes are downloaded separately and each is 5 to 8 GB. Updating Xcode adds a new one but keeps the old ones.

xcrun simctl runtime list
xcrun simctl runtime delete <runtime identifier>

Keep the runtimes of the oldest iOS version your app supports if you test on it. A deleted runtime can be downloaded again from Xcode › Settings › Components.

Archives

~/Library/Developer/Xcode/Archives has one .xcarchive per build you archived for TestFlight or the App Store. Unlike the rest, these are not caches: an archive holds the dSYM files you need to read the crash reports of that build. Keep the archives of every version still in users’ hands (unless your crash reporter already has the dSYMs), and remove old ones from Window › Organizer › Archives, or move them to the Trash in Finder so you can change your mind.

ls -lt ~/Library/Developer/Xcode/Archives

iOS DeviceSupport

The first time you connect an iPhone or iPad running a new version, Xcode copies its debug symbols to ~/Library/Developer/Xcode/iOS DeviceSupport: one folder per version, 2 to 5 GB each. watchOS DeviceSupport and tvOS DeviceSupport work the same way.

du -sh ~/Library/Developer/Xcode/*DeviceSupport/* | sort -h
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/<version folder>

Remove the versions no device of yours runs any more. If you connect such a device again, Xcode copies the symbols again, which takes a few minutes.

Documentation cache, device logs and CocoaPods

Three smaller folders that add up:

pod repo list
pod repo remove master
pod cache clean --all     # downloaded pods; the next pod install fetches them

How CleanMate does it

CleanMate puts every item above in the developer junk of Smart Scan (all macOS features), each with its size, and nothing is removed until you confirm:

For the rest of the developer junk on a Mac, read Free up disk space on a Mac as a developer; for containers, Docker using too much disk space.

For mobile projects, see Flutter, React Native and the iOS Simulator filling your Mac.

Looking for a free BuhoCleaner alternative? See how CleanMate compares, feature by feature.

Skip the commands

Open source — star it on GitHub: CleanMate for macOS

How CleanMate decides what is safe to remove →