Skip to content

Instantly share code, notes, and snippets.

@tsangint
Last active January 2, 2019 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsangint/d37db61a6814282353b859966b5c265d to your computer and use it in GitHub Desktop.
Save tsangint/d37db61a6814282353b859966b5c265d to your computer and use it in GitHub Desktop.
iOS simulator shell
#!/usr/bin/python
# usage: ./ios-simulator.sh "iPhone XR"
import os
import re
import sys
name=sys.argv[1]
print "Finding "+name
process=os.popen("xcrun simctl list devices","r")
processOutput=process.read()
matched=re.search(name+'\s\(([A-z0-9\-]+)', processOutput)
# print processOutput;
process.close()
if matched :
print "UDID is "+matched.group(1)
os.system("open -a Simulator --args -CurrentDeviceUDID "+matched.group(1))
print "Simulator lanched"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment