Created
January 20, 2012 14:57
-
-
Save jakemarsh/1647709 to your computer and use it in GitHub Desktop.
Simple Applescript that can be run from the command line to programmatically reset the iOS simulator.
This file contains hidden or 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
tell application "iPhone Simulator" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "iPhone Simulator" | |
tell menu bar 1 | |
tell menu bar item "iOS Simulator" | |
tell menu "iOS Simulator" | |
click menu item "Reset Content and Settings…" | |
end tell | |
end tell | |
end tell | |
tell window 1 | |
click button "Reset" | |
end tell | |
end tell | |
end tell | |
-- Run at the command line or from a shell script using something like: 'osascript reset_simulator.applescript' |
+1 RussVanBert's comment
In Yosemite + iOS Simulator 8.3, I changed the string of "iPhone Simulator" to "iOS Simulator" and it worked.
Updated for El Capitan (10.11.4), Xcode Version 7.3.1, iOS Simulator Version 9.3
tell application "Simulator"
activate
end tell
tell application "System Events"
tell process "Simulator"
tell menu bar 1
tell menu bar item "Simulator"
tell menu "Simulator"
click menu item "Reset Content and Settings…"
end tell
end tell
end tell
tell window 1
click button "Reset"
end tell
end tell
end tell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Mavericks, it was not finding the Reset button. I changed the line to "click button 1" and it worked.