Created
June 14, 2018 22:41
-
-
Save ricardopereira/adae5038191ac9f8d4ee03c23fde1b8c to your computer and use it in GitHub Desktop.
How to enable/disable “Show as run destination” for all simulators https://stackoverflow.com/questions/50796954/how-to-enable-disable-show-as-run-destination-for-all-simulators
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
simulatorsIdentifiers=$(instruments -s devices | | |
grep -o "iPhone .* (.*) \[.*\]" | #only iPhone | |
grep -o "\[.*\]" | #only UUID | |
sed "s/^\[\(.*\)\]$/\1/" | #remove square brackets | |
sed 's/^/"/;$!s/$/"/;$s/$/"/' | #add quotes | |
sed '$!s/$/,/' #add comma to separate each element | |
) | |
arrayOfSimulatorsIdentifiers=($(echo "$simulatorsIdentifiers" | tr ',' '\n')) | |
# Add simulators to DVTIgnoredDevices | |
echo "${#arrayOfSimulatorsIdentifiers[@]}" | |
for index in "${!arrayOfSimulatorsIdentifiers[@]}" | |
do | |
echo "$index Adding: ${arrayOfSimulatorsIdentifiers[index]}" | |
done | |
defaults write com.apple.dt.Xcode DVTIgnoredDevices -array ${arrayOfSimulatorsIdentifiers[@]} |
This is a god send. Thanks you.
All I want is to reorder devices displayed in run target. What can I say a $trillion company can't assign a resource for it.
My current solution is disable everything and enable only the few I use.
for xcode 13 this works for me
simulatorsIdentifiers=$(xcrun xctrace list devices |
grep -e "iPhone" -e "iPad" | #iPhone and iPad
grep -oE "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" | #only UUID
sed 's/^/"/;$!s/$/"/;$s/$/"/' | #add quotes
sed '$!s/$/,/' #add comma to separate each element
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to hide all iPad and iPhone simulators then change
line 2
withgrep -e "iPhone .* (.*) \[.*\]" -e "iPad .* (.*) \[.*\]" | #iPhone and iPad