Created
July 9, 2016 20:01
-
-
Save nicnocquee/0e0de8a26a287f081338f5dbcaec646f to your computer and use it in GitHub Desktop.
Boot or reboot iOS simulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BOOTING="Booting " | |
| if [ $# -eq 0 ] | |
| then | |
| SIMULATOR=$(xcrun simctl list | grep Booted | cut -d$'\n' -f1 | cut -d "(" -f2 | cut -d ")" -f1) | |
| if [ ! -z "$SIMULATOR" ]; then | |
| SIMULATORNAME=$(xcrun instruments -s | grep $SIMULATOR | cut -d "[" -f1) | |
| BOOTING="Rebooting $SIMULATORNAME" | |
| fi | |
| else | |
| SIMULATOR=$1 | |
| BOOTING="Booting $SIMULATOR" | |
| fi | |
| if [ -z "$SIMULATOR" ]; then | |
| echo "No running simulator. You need to specify device: $0 \"iPhone 6 (9.3)\"" | |
| exit | |
| fi | |
| echo $BOOTING | |
| killall Simulator > /dev/null 2>&1 | |
| open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID $(xcrun instruments -s | grep "$SIMULATOR" | grep -v "Apple Watch" | cut -d "[" -f2 | cut -d "]" -f1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment