Created
February 9, 2016 10:18
-
-
Save douglashill/dbef73ae1aa3c6ead9f1 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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