Skip to content

Instantly share code, notes, and snippets.

@cpageler93
Created June 26, 2020 14:01
Show Gist options
  • Save cpageler93/cd74618d573486d9c07435f9977a67c0 to your computer and use it in GitHub Desktop.
Save cpageler93/cd74618d573486d9c07435f9977a67c0 to your computer and use it in GitHub Desktop.
Clears existings iOS Simulators and creates new ones
#!/usr/bin/env ruby
simulators = [
{
:name => "iOS 12",
:runtime => "com.apple.CoreSimulator.SimRuntime.iOS-12-0",
:devices => [
{
:name => "iPhone SE",
:id => "com.apple.CoreSimulator.SimDeviceType.iPhone-SE"
},
{
:name => "iPhone X",
:id => "com.apple.CoreSimulator.SimDeviceType.iPhone-X"
}
]
},
{
:name => "iOS 13",
:runtime => "com.apple.CoreSimulator.SimRuntime.iOS-13-5",
:devices => [
{
:name => "iPhone SE (2nd generation)",
:id => "com.apple.CoreSimulator.SimDeviceType.iPhone-SE--2nd-generation-"
},
{
:name => "iPhone 11",
:id => "com.apple.CoreSimulator.SimDeviceType.iPhone-11"
}
]
}
]
puts "Delete all simulators"
`xcrun simctl delete all`
simulators.each { |simulator|
runtime_name = simulator[:name]
runtime = simulator[:runtime]
devices = simulator[:devices]
puts "Launch Runtime #{runtime_name} ..."
devices.each { |device|
device_name = device[:name]
device_id = device[:id]
puts "- #{device_name}"
`xcrun simctl create \"#{device_name} (#{runtime_name})\" \"#{device_id}\" \"#{runtime}\"`
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment