Skip to content

Instantly share code, notes, and snippets.

@JALsnipe
Last active December 7, 2015 15:28
Show Gist options
  • Save JALsnipe/e0dbd5865cc715e3b2ce to your computer and use it in GitHub Desktop.
Save JALsnipe/e0dbd5865cc715e3b2ce to your computer and use it in GitHub Desktop.
Reset all iOS Simulators
# Reset all iOS Simulators
# Modified to reset without prompt from stdin
simulatorList = []
# Get all of the simulator UUIDs from Xcode
rawSimulatorList = `xcrun simctl list`
rawSimulatorList.each_line do |line|
if line.start_with?(" ")
simulator = line.strip
# Ignore any simulators that aren't working
if !simulator.include?("unavailable")
# Extract the UUID
uuid = simulator.match(/\([A-Z0-9\-]+\)/)[0]
uuid = uuid.gsub("(","")
uuid = uuid.gsub(")","")
# Extract the device name
deviceName = simulator.split(' ')[0] + " " + simulator.split(' ')[1]
device = { "name" => deviceName, "uuid" => uuid }
simulatorList.push(device)
end
end
end
simulatorList.each do |simulator|
print "Erasing #{simulator['name']}... "
`xcrun simctl erase #{simulator['uuid']}`
puts "Done"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment