Skip to content

Instantly share code, notes, and snippets.

@NicholasTD07
Created July 15, 2015 07:28
Show Gist options
  • Save NicholasTD07/25e81bbe91c8b5c1e91b to your computer and use it in GitHub Desktop.
Save NicholasTD07/25e81bbe91c8b5c1e91b to your computer and use it in GitHub Desktop.
Clean up ghost iOS simulators in `xcrun simctl`
#!/bin/sh
# I was having ghost devices in my iOS Simulator.
# There were multiple device for one device type, one OS.
# For example, there were at least 4-5 devices for iPhone 6, OS 8.4
# USE IT AT YOUR OWN RISK
devices=(`xcrun simctl list devices | grep -v '^[-=]' | cut -d "(" -f2 | cut -d ")" -f1`)
for device in $devices; do
xcrun simctl boot $device 1>/dev/null 2>&1 || xcrun simctl delete $device && xcrun simctl shutdown $device
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment