Free Up Disk Space Used by iOS Simulators

Simulators take space in two places: each device's own data, and the iOS runtime images they boot from. Both can be cleared by hand with xcrun simctl, as long as you know which command loses what.

Updated:

Where simulator space goes

Every simulator you see in Xcode is a folder under ~/Library/Developer/CoreSimulator/Devices, named by its UDID. It holds the apps you installed, their containers, photos, keychains and caches, so a simulator you test on every day grows over time. The operating system it runs is separate: each iOS, watchOS, tvOS or visionOS version is a runtime, stored as a disk image under /Library/Developer/CoreSimulator.

On one developer's Mac, device folders took 19 GB and two iOS runtimes another 15.3 GB. Measure your own before deciding anything:

# device data, total and per simulator
du -sh ~/Library/Developer/CoreSimulator/Devices
du -sh ~/Library/Developer/CoreSimulator/Devices/*/ | sort -h | tail

# installed runtimes and their total size
xcrun simctl runtime list

Parallel test runs also clone simulators into ~/Library/Developer/XCTestDevices. Those clones are created per test run, so the folder can be cleared when no tests are running.

List your simulators

simctl list shows every simulator with its UDID and state. Match the UDIDs to the folder sizes above to see which device is the heavy one.

# all devices, grouped by runtime
xcrun simctl list devices

# only the ones running right now
xcrun simctl list devices booted

# runtimes known to this Xcode
xcrun simctl list runtimes

Erase or delete: what each one loses

There are two ways to get a simulator's space back, and they are not the same.

  • Erase (xcrun simctl erase <UDID>) resets the device to factory state. Installed apps, their data, photos and settings are gone, but the simulator stays in Xcode's device list with the same name and UDID. Your schemes and scripts that point to it keep working. Use this for a device you still test on.
  • Delete (xcrun simctl delete <UDID>) removes the simulator completely. It disappears from Xcode, and anything that refers to its UDID stops finding it. Use this for devices you no longer need, such as an extra copy you created once.
# reset one simulator, keep it in the list
xcrun simctl shutdown <UDID>
xcrun simctl erase <UDID>

# remove one simulator for good
xcrun simctl delete <UDID>

Both commands also accept all. xcrun simctl erase all resets every simulator; xcrun simctl delete all removes every simulator. After deleting, Xcode does not recreate your custom devices; you add them again from Window > Devices and Simulators. Nothing in a simulator is backed up, so test data, screenshots saved inside it and signed-in test accounts are lost in both cases.

Delete simulators that no longer work

When you remove an old runtime or upgrade Xcode, the simulators that ran on that runtime stay behind but can no longer boot. simctl calls them unavailable. One command removes exactly those and leaves every working simulator alone:

xcrun simctl delete unavailable

This is the safest cleanup command in this guide: it only deletes devices that are not supported by the current Xcode, which you could not boot anyway.

Remove old simulator runtimes

Runtimes are usually the largest single items. Xcode downloads a new one with each major release and keeps the old ones. You only need the runtimes you actually test against.

The easiest way is in Xcode: open Xcode > Settings > Components, select the old runtime and remove it. From Terminal, simctl runtime delete does the same, and it has a dry run, so you can see what would go before anything is removed. Runtimes are shared by all simulators of that OS version, so removing one affects every device listed under it:

# see installed runtimes with their identifiers
xcrun simctl runtime list

# preview: runtimes that have a newer build of the same version
xcrun simctl runtime delete --outdated --dry-run

# preview: runtimes not used in the last 90 days
xcrun simctl runtime delete --notUsedSinceDays 90 --dry-run

# remove one runtime by its identifier from the list
xcrun simctl runtime delete <identifier>

Run the same command without --dry-run once the preview looks right. The simulators that used a deleted runtime become unavailable; clear them afterwards with xcrun simctl delete unavailable.

CoreSimulator caches

/Library/Developer/CoreSimulator/Caches holds a dyld shared cache per runtime build, which makes simulators start faster. It belongs to the system-wide folder, so removing it needs administrator rights, and the cache is rebuilt the next time a simulator boots, which makes that boot slow. Deleting a runtime is the cleaner way to get this space back. ~/Library/Developer/CoreSimulator/Caches is your user-level cache folder; it is often small, check it with du -sh before bothering.

Simulators are only one part of what Xcode leaves behind. Build products are covered in clearing DerivedData, device symbols in the DeviceSupport guide, and the bigger picture in why System Data is so large.

Doing it with CleanDev

The full edition of CleanDev (direct download, launching soon) resets simulator content with simctl erase, so devices keep their name and UDID and stay in Xcode. A booted simulator is never touched, and each item shows how much space it takes and what resetting it removes. It does not delete simulators or remove runtimes yet; use Xcode > Settings > Components or the commands above for those.

Questions

Is it safe to delete the CoreSimulator folder?

Deleting ~/Library/Developer/CoreSimulator/Devices by hand removes every simulator and can leave Xcode's device list out of sync. Use xcrun simctl erase or xcrun simctl delete instead; they do the same job and keep CoreSimulator consistent.

What does xcrun simctl delete unavailable do?

It deletes simulators whose runtime is no longer supported by the current Xcode, typically after an Xcode upgrade or runtime removal. Working simulators are not affected.

Will erasing a simulator delete my app's code?

No. Erasing only resets the simulated device: installed apps and their data inside it. Your project and source code are elsewhere, and the app is reinstalled the next time you run it from Xcode.

How do I delete an old iOS simulator runtime?

In Xcode, open Settings > Components and remove it there. From Terminal, find its identifier with xcrun simctl runtime list and run xcrun simctl runtime delete <identifier>, after checking with --dry-run.

Why does a simulator take several gigabytes?

Each simulator stores its own copy of installed apps, their data, caches and media. Devices you use every day for testing grow steadily; erasing them returns that space.

More guides