How to Reset the iOS Simulator from the Command Line

Is there a command to restart the Xcode iOS simulator from command line?

I'm using xcode 11.3 but this seems to work for me:

export UDID=$(xcrun simctl list devices | grep "(Booted)" | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})")  
xcrun simctl shutdown $UDID
xcrun simctl boot $UDID

Might be worth giving it an update to the latest xcode.

How to reset iOS simulator?

It is under "Hardware" section.

Reset the contents and settings all iOS-simulators

I present,

The Definitive iOS Simulator Reset Script (link)

Sample Image

Based on Oded Regev's code from this SO question (which was based on Jacob Rus's fine "menu_click" code)

How to reset iPhone simulator

For iOS 14 and newer:

Device > Erase All Contents and Settings...

For iOS 11 and newer:

Hardware > Erase All Contents and Settings...

For previous versions:

Simulator > Reset Content and Settings...

(In earlier versions of the simulator the top menu entry label was "iOS Simulator"

Is there a way to close the iOS Simulator from the command line?

killall "iOS Simulator" in the Terminal will close it.

Also, you can launch it with iphonesim to have more control over it, including modifying the source to your needs.

Reset iOS Simulator with Applescript

I present,

The Definitive iOS Simulator Reset Script (link)

Sample Image

Based on Oded Regev's code from this SO question (which was based on Jacob Rus's fine "menu_click" code)



Related Topics



Leave a reply



Submit