#!/usr/bin/env ruby | |
require 'JSON' | |
device_types = JSON.parse `xcrun simctl list -j devicetypes` | |
runtimes = JSON.parse `xcrun simctl list -j runtimes` | |
devices = JSON.parse `xcrun simctl list -j devices` | |
devices['devices'].each do |runtime, runtime_devices| | |
runtime_devices.each do |device| | |
puts "Removing device #{device['name']} (#{device['udid']})" | |
`xcrun simctl delete #{device['udid']}` | |
end | |
end | |
device_types['devicetypes'].each do |device_type| | |
runtimes['runtimes'].select{|runtime| runtime['availability'] == '(available)'}.each do |runtime| | |
puts "Creating #{device_type['name']} with #{runtime['name']}" | |
command = "xcrun simctl create '#{device_type['name']} #{runtime['name']}' #{device_type['identifier']} #{runtime['identifier']}" | |
command_output = `#{command}` | |
sleep 0.5 | |
end | |
end |
This comment has been minimized.
This comment has been minimized.
Follow these guidelines to use this script : http://stackoverflow.com/a/35600096/1996802 |
This comment has been minimized.
This comment has been minimized.
If you're using a more recent version of Ruby, you may need to change |
This comment has been minimized.
This comment has been minimized.
Great, looks good! Just one strange thing - I get these errors:
for almost every device… I mean it doesn't seem to make sense to e.g. create "iPad Air 2 with tvOS 9.1", so I guess this is OK? |
This comment has been minimized.
This comment has been minimized.
Thanks for the script, it helps a lot. But it seems that it creates all simulators for every version and device in xcode, even they are not downloaded yet. |
This comment has been minimized.
This comment has been minimized.
If you are a CocoaPod writer, You might want to change line 19 from command = "xcrun simctl create '#{device_type['name']} #{runtime['name']}' #{device_type['identifier']} #{runtime['identifier']}" to command = "xcrun simctl create '#{device_type['name']}' #{device_type['identifier']} #{runtime['identifier']}" to omit generating simulator names like |
This comment has been minimized.
Warning: This is completely untested. It will REMOVE all your simulators along with all settings and installed Apps. It worked for me to create the initial set of simulators.