Skip to content

Instantly share code, notes, and snippets.

@douglashill
Created February 9, 2016 10:18
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 douglashill/dbef73ae1aa3c6ead9f1 to your computer and use it in GitHub Desktop.
Save douglashill/dbef73ae1aa3c6ead9f1 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#coding: utf-8
import json
import subprocess
def delete_all_simulators():
devices_json = subprocess.check_output(["xcrun", "simctl", "list", "--json", "devices"])
devices_by_runtime = json.loads(devices_json)["devices"]
for runtime, devices in devices_by_runtime.iteritems():
for device in devices:
subprocess.call(["xcrun", "simctl", "delete", device["udid"]])
def create_simulators():
types_json = subprocess.check_output(["xcrun", "simctl", "list", "--json", "devicetypes"])
types = json.loads(types_json)["devicetypes"]
for device_type in types:
subprocess.call(["xcrun", "simctl", "create", "iOS 9.2 - " + device_type["name"], device_type["identifier"], "com.apple.CoreSimulator.SimRuntime.iOS-9-2"])
def main():
delete_all_simulators()
create_simulators()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment