I need to reset the iPhone Simulator a lot, and haven't found a way to do it without using the mouse. It's a small thing, but I'm really sick of doing it and would love to have a way to do this using a keyboard shortcut.
Even better would be a way to reset it from the command line, so I could build a reset into a deploy script.
I am not very familiar with iOS or MacOS.
You need to click on Simulator first. Hardware > Erase All Content and Settings. This will reset the simulator. Wait for a minute for the Simulator to rebuild.
Go to Window > Devices and simulators, then select the Simulators tab. You can right-click on any simulator and select 'delete' to get rid of it.
Just run this in the terminal:
xcrun simctl shutdown all && xcrun simctl erase all
Another approach suggested by @txulu, before erasing the simulator kill the process:
killall "Simulator" 2> /dev/null; xcrun simctl erase all
In Xcode 6, DO NOT JUST DELETE THE FOLDER FOR THE SIMULATOR! It WILL screw things up, and it WILL cause you a headache.
In Xcode 6, there's actually a tool to control the simulator from the command line.
Make sure your command line settings are set to Xcode 6
xcrun simctl
In Xcode 6, each device has a GUID/UUID associated to it, to reset a specific device, you need the GUID for it.
The command
xcrun simctl list
will show you all of the devices you have set up. The output will look like this:
== Devices == -- iOS 7.0 -- iPhone 4s (F77DC0AE-6A6D-4D99-9936-F9DB07BBAA82) (Shutdown) iPhone 5 (5B78FC0D-0034-4134-8B1F-19FD0EC9D581) (Shutdown) iPhone 5s (569E5910-E32D-40E2-811F-D2E8F04EA4EF) (Shutdown) iPad 2 (451DBBD8-A387-4E77-89BF-2B3CD45B4772) (Shutdown) iPad Retina (2C58366B-5B60-4687-8031-6C67383D793F) (Shutdown) iPad Air (50E03D3B-3456-4C49-85AD-60B3AFE4918B) (Shutdown) -- iOS 7.1 -- -- iOS 8.0 -- iPhone 4s (27818821-A0BB-496E-A956-EF876FB514C2) (Shutdown) iPhone 5 (6FBAA7E2-857C-432A-BD03-980D762DA9D2) (Shutdown) iPhone 5s (7675C82B-DE49-45EB-A28D-1175376AEEE9) (Shutdown) iPad 2 (836E7C89-B9D6-4CC5-86DE-B18BA8600E7B) (Shutdown) iPad Retina (EFDD043D-2725-47DC-A3FF-C984F839A631) (Shutdown) iPad Air (9079AD6C-E74D-4D5F-9A0F-4933498B852E) (Shutdown) Resizable iPhone (943CFEDE-A03C-4298-93E3-40D0713652CB) (Shutdown) Resizable iPad (DBA71CA5-6426-484B-8E9B-13FCB3B27DEB) (Shutdown)
Just copy the GUID from inside the parentheses, and run xcrun simctl erase
for example,
xcrun simctl erase 5B78FC0D-0034-4134-8B1F-19FD0EC9D581
would erase the iOS 7.0, iPhone 5 device
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With