macOS Xcode CoreSimulator folder very big. Is it ok to delete content?

XcodeMacosXcode7Diskspace

Xcode Problem Overview


My ~/Library/Developer/CoreSimulator/Devices folder is 26 Gb in size.

Is it safe to just delete all the content? Will those files be automatically regenerated?

Xcode Solutions


Solution 1 - Xcode

Try to run xcrun simctl delete unavailable in your terminal.

Original answer: Xcode - free to clear devices folder?

Solution 2 - Xcode

That directory is part of your user data and you can delete any user data without affecting Xcode seriously. You can delete the whole CoreSimulator/ directory. Xcode will recreate fresh instances there for you when you do your next simulator run. If you can afford losing any previous simulator data of your apps this is the easy way to get space.

Update: A related useful app is "DevCleaner for Xcode" https://apps.apple.com/app/devcleaner-for-xcode/id1388020431

Solution 3 - Xcode

For iOS developers who find that they have very little available storage space without knowing why:

Check how many simulators that you have downloaded as they take up a lot of space (previous ones are not removed when you update XCode so this will quickly add up):

Go to: ~/Library/Developer/Xcode/iOS DeviceSupport

Also delete old archived apps that are no longer important to you:

Go to: ~/Library/Developer/Xcode/Archives

I cleared 100GB doing this.

UPDATE: You can now easily do this by just going to the Apple icon in the top left corner -> About this Mac -> Storage -> Manage... -> Developer

Solution 4 - Xcode

for Xcode 8:

What I do is run sudo du -khd 1 in the Terminal to see my file system's storage amounts for each folder in simple text, then drill up/down into where the huge GB are hiding using the cd command.

Ultimately you'll find the Users//Library/Developer/CoreSimulator/Devices folder where you can have little concern about deleting all those "devices" using iOS versions you no longer need. It's also safe to just delete them all, but keep in mind you'll lose data that's written to the device like sqlite files you may want to use as a backup version.

I once saved over 50GB doing this since I did so much testing on older iOS versions.

Solution 5 - Xcode

You can also remove ~/Library/Developer/CoreSimulator/Caches/dyld/ directory and free a lot of memory.

Solution 6 - Xcode

In addition to xcrun simctl delete unavailable, you can also clean up all simulated OS data and apps at once:

 xcrun simctl erase all

That is, in case you don't need the data and installed apps on the simulators. Which you most likely don't - Xcode will install the OS and your app(s) next time you run it in one of the simulators.

This might free up some more gigabytes of disk space.

(Also in case xcrun says simctl could not be found: make sure the location of your dev tools is correctly specified in Xcode Preferences -> Locations -> Command Line Tools)

Solution 7 - Xcode

I created a small command-line utility that cleans the CoreSimulator folder and some other Xcode-related folders that might take up extra space, specified in this answer. If you think this is something that would help you, you can check it out here.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFranckView Question on Stackoverflow
Solution 1 - XcodePetr SyrovView Answer on Stackoverflow
Solution 2 - XcodeMacMarkView Answer on Stackoverflow
Solution 3 - XcodeAlexanderNView Answer on Stackoverflow
Solution 4 - XcodewhyozView Answer on Stackoverflow
Solution 5 - XcodeDenView Answer on Stackoverflow
Solution 6 - XcodemojubaView Answer on Stackoverflow
Solution 7 - XcodelajosdemeView Answer on Stackoverflow