I am deleting some folders and files to make more space on my drive. I know that in path:
~/Library/Developer/CoreSimulator/Devices/
There are folders for each simulator and each version. This folder has around 11GB size for me. I know that I could delete simulators with old versions that I no longer use. But from that unique identifier I can't know which is the right one and which not. So my question is: Can I delete it all? It's okay if next time I wouldn't have any of my app in simulator but can I loose something more? Old versions of simulator? Or anything else? Thanks
The ~/Library/Developer/CoreSimulator/Devices/
path is where Xcode stores most of the data needed for your individual simulator devices.
Beau Nouvelle's suggestion about deleting downloaded simulator versions would not change the size of these folders, as the runtimes are stored elsewhere.
If you go to the terminal, you can use the simctl tool (comes with Xcode 6+) to list all of the actual simulator devices you have, along with the ids so that you can figure out what folders to delete.
Note, you'll see me constantly use xcrun simctl in this answer. That adds a bit of abstraction to things by having xcrun go look up the appropriate version of simctl for your currently chosen Xcode. Depending on your system, you might get by with dropping the "xcrun" part and the commandline should still find the simctl tool.
xcrun simctl list devices
Here are some selected snippets of the output I received:
== Devices == -- iOS 8.2 -- -- iOS 8.4 -- iPhone 6 Plus (23E36868-715A-48C8-ACC3-A735C1C83383) (Shutdown) iPad Air (2928379B-70E3-4C59-B5BA-66187DDD3516) (Shutdown) -- iOS 9.1 -- My Custom iPhone 4s (4F27F577-FFD0-42C1-8680-86BBA7394271) (Shutdown) iPad Retina (85717B35-313A-4161-850E-D99D5C8194A6) (Shutdown) -- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-0 -- iPhone 4s (D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3) (Shutdown) (unavailable, runtime profile not found)
From that you can see that I have no iOS 8.2 simulator devices. I have some 9.1 and 8.4 simulator devices. I do have a 9.0 simulator device made (a remnant of my work on Xcode 7.0), but I don't have the 9.0 simulator runtime itself. So that's a good candidate for deletion, or a reminder that I should go download the 9.0 simulator in Xcode.
If you want, you can use those ids to identify the folder for the device in question and delete it manually (in this case I would delete the "D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3" folder), but you can also use the simctl tool to do that.
Usage according to the 7.1.1 version of simctl:
xcrun simctl help delete
Usage: simctl delete <device> [... <device n>] | unavailable
So I can either delete the individual device(s):
xcrun simctl delete D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3
or I can bulk delete all of the unavailable ones with:
xcrun simctl delete unavailable
There is also no need to limit yourself purely to unavailable simulators.
If you need any further help with the tool, it comes with a fairly straight forward help command:
xcrun simctl help
--
Later versions of Xcode have made the above steps less effective. I only know about Xcode 13.1 for sure. While deleting the simulators still clears up space in the ~/Library/Developer/CoreSimulator/Devices/
folder, sometimes this doesn't help as the files have just moved to live off under /var/folders
in some folder called Deleting-<guid>
, which takes up about as much space as the device original did. But this location requires root privileges to clean up or a reboot, neither of which are desirable. From some testing a colleague did, it seems if you delete the device folders first and then delete the device via xcrun simctl delete
, this isn't an issue.
Sometimes Xcode likes to double up on its simulators.
Usually the fix for me has always been to just delete them all. Deleting them is harmless as you can always download them again later.
Xcode > Preferences > Downloads
Just remember that if you have any old simulators in there (iOS 8.0-) you won't be able to download them again through Xcode.
UPDATE!
You can now manage Xcode devices on the latest macOS through the storage manager.
About This Mac > Storage > Manage > Developer
https://i.stack.imgur.com/tCCOl.png
Another UPDATE!
Xcode 14 now asks you at installation time the simulators you want to install. Xcode is now smaller in size, and faster to install — unless you develop for all platforms.
I had a similar issue a while back, xcode was taking up 47G on my drive. I tried deleting some Simulator Devices which stopped my xcode from working (crazy). So i deleted everthing related to xcode and installed fresh. Its just my experience.
in Xcode 8:
Run $ sudo du -khd 1 in Terminal to see the folder size of each folder;
Run $ cd library/developer/coresimulator/devices to see the GB stored for all your Xcode simulators; You'll begin to see where a ton of storage is hiding! Now just navigate to that location on your Macintosh HD and view the devices.plist in each device folder; Decide which folders to delete and keep by deleting any simulators/iOS versions you've ran in the past but no longer need for testing. Old sqlite versions that could act as old backups, or other content exists in these folders, so consider that before you delete everything in this folder.
I saved over 50GB the first time I did this.
Success story sharing
xcrun: error: unable to find utility "simctl"
, you should be able to use,xcrun /Applications/Xcode.app/Contents/Developer/usr/bin/simctl
/Applications/Xcode.app/Contents/Developer/usr/bin/simctl
simctl delete unavailable
, pruning devices going back a number of iOS versions. I had no idea these were still there. Win!unavailable one
by usingxcrun simctl delete unavailable
, but the folder is still too large..delete unavailable