Today I witnessed a conversation about tons of unused iOS simulators on Twitter.
I had the same problem recently and looked for an easy way to clean up all the unused simulators. On StackOverflow I found out about xcrun simctl, which lets you list and delete arbitrary simulators. I ended up creating this little shell one-liner to delete all simulator data packages for which the simulator is no longer installed:
xcrun simctl list | grep unavailable | cut -d “(“ -f 2 | cut -d “)” -f 1 | while read sim; do xcrun simctl delete $sim; done
This lists all the simulators, filters for the unavailable ones, extracts the simulator IDs, and then iterates over them and deletes them. Be aware, though, that this also deletes your simulators for iOS 9 and watchOS 2 if you did not xcode-select the Xcode beta for your command line tools (and if you did, it might actually delete your simulators for iOS 8.4). In that case, you may want to first output the list of simulators to a file:
xcrun simctl list > simulators.txt
Then edit that file, leaving only the simulators you wish to remove, and execute
cat simulators.txt | cut -d “(“ -f 2 | cut -d “)” -f 1 | while read sim; do xcrun simctl delete $sim; done
Done! Your simulator list should look like this again:
P.S.: Ortwin points out that you might need to do a
P.P.S.: There are of course also other ways to accomplish this, but this one doesn’t require you to install any extra tools.