Skip to content

Instantly share code, notes, and snippets.

@DnyaneshwarWagh
Last active July 4, 2019 19:18
Show Gist options
  • Save DnyaneshwarWagh/5df48adb1705b42e7f63135301904a68 to your computer and use it in GitHub Desktop.
Save DnyaneshwarWagh/5df48adb1705b42e7f63135301904a68 to your computer and use it in GitHub Desktop.
Simulator Populator for Xcode-10 and Xcode-11
#!/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`
#=begin
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
#=end
device_types['devicetypes'].each do |device_type|
runtimes['runtimes'].select{|runtime| runtime['isAvailable'] == true }.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}`
#puts "xcrun simctl create '#{device_type['name']} #{runtime['name']}' #{device_type['identifier']} #{runtime['identifier']}"
sleep 0.5
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment