Skip to content

Instantly share code, notes, and snippets.

@moisoto
Last active March 30, 2021 02:59
Show Gist options
  • Save moisoto/b5d469b7a1c8f940c361850bc9e03e6a to your computer and use it in GitHub Desktop.
Save moisoto/b5d469b7a1c8f940c361850bc9e03e6a to your computer and use it in GitHub Desktop.

macOS / Xcode 12 - Recover space used by Xcode Device Simulators

Check your current Simulators:

To check the simulators currently installed in your system:

$ xcrun simctl list

Check Occupied Space:

$ du -h -d0 ~/Library/Developer/CoreSimulator/Devices

Erase Unavailable

To erase all unavailable simulators (not compatible with your current Simulator version)

$ xcrun simctl delete unavailable

List the remaining ones:

To erase all unavailable simulators (not compatible with your current Simulator version)

$ xcrun simctl list

Still too many Simulators?

If the simulators listed are too many and you want to keep just some of them, you may use this useful command I found here.

This command will only delete simulators that are shutdown. You can load xcode and open simulators you want to keep then run the command:

xcrun simctl list | grep -w "Shutdown"  | grep -o "([-A-Z0-9]*)" | sed 's/[\(\)]//g' | xargs -I uuid xcrun simctl delete  uuid

Cleaning the DYLD cache

# Check space taken by dyld cache
du -h ~/Library/Developer/CoreSimulator/Caches/dyld

You may delete them manually if you want, or run the following command to swiftly erase them:

sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/dyld/*

Check Logs

The logs folder may be really big if you do a lot of testings:

# Check space taken by Simulator Logs
du -h -d0 ~/Library/Logs/CoreSimulator

You may delete them manually if you want, or run the following command to swiftly erase them:

sudo rm -rf ~/Library/Logs/CoreSimulator/*

Still need more space?

If you want to squeeze every last byte that can be recovered, check this article that goes deeper on all temporary files:

https://lovemewithoutall.github.io/it/xcode-clean-up/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment