Last active
July 10, 2023 12:45
-
-
Save acoomans/7650062501ce575404f186bb7f3900c2 to your computer and use it in GitHub Desktop.
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 | |
UUID_REGEX='s/^.*\([0-9A-Z]\{8\}-[0-9A-Z]\{4\}-[0-9A-Z]\{4\}-[0-9A-Z]\{4\}-[0-9A-Z]\{12\}\).*$/\1/p' | |
xcrun simctl shutdown all | |
xcrun simctl delete unavailable | |
xcrun simctl list devices | sed -n $UUID_REGEX | xargs -I {} xcrun simctl erase "{}" | |
xcrun simctl list devices | sed -n $UUID_REGEX | xargs -I {} xcrun simctl delete "{}" | |
rm -fr "$HOME"/Library/Developer/CoreSimulator/Devices/* | |
cat << EOF > "$HOME/Library/Developer/CoreSimulator/Devices/device_set.plist" | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DefaultDevices</key> | |
<dict> | |
</dict> | |
<key>DevicePairs</key> | |
<dict/> | |
<key>Version</key> | |
<integer>0</integer> | |
</dict> | |
</plist> | |
EOF | |
LATEST_IPHONE=`xcrun simctl list devicetypes | sed -n 's/^iPhone.*(\(com.*\))$/\1/p' | tail -n 1` | |
LATEST_IOS=`xcrun simctl list runtimes | sed -n 's/^iOS.*\(com.*\)$/\1/p'` | |
xcrun simctl create "Latest iPhone" "$LATEST_IPHONE" "$LATEST_IOS" | |
xcrun simctl create "iPhone 8 Plus" "com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus" "$LATEST_IOS" | |
xcrun simctl list devices |
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 | |
UUID_REGEX='s/^.*\([0-9A-Z]\{8\}-[0-9A-Z]\{4\}-[0-9A-Z]\{4\}-[0-9A-Z]\{4\}-[0-9A-Z]\{12\}\).*$/\1/p' | |
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService | |
xcrun simctl shutdown all | |
xcrun simctl delete unavailable | |
xcrun simctl list devices | sed -n $UUID_REGEX | xargs -I uuid xcrun simctl delete "uuid" | |
LATEST_IPHONE=`xcrun simctl list devicetypes | sed -n 's/^iPhone.*(\(com.*\))$/\1/p' | tail -n 1` | |
LATEST_IOS=`xcrun simctl list runtimes | sed -n 's/^iOS.*\(com.*\)$/\1/p'` | |
xcrun simctl create "Latest iPhone" "$LATEST_IPHONE" "$LATEST_IOS" | |
xcrun simctl list devices |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment