Last active
December 7, 2015 15:28
-
-
Save JALsnipe/e0dbd5865cc715e3b2ce to your computer and use it in GitHub Desktop.
Reset all iOS Simulators
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
# 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