How can I reset the iOS Simulator from the command line?

Cameron Brown picture Cameron Brown · Feb 26, 2011 · Viewed 39k times · Source

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.

Answer

Kappe picture Kappe · Jul 9, 2015

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