Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have found a command to killall simulators but does not fit my needs. I need to be able to restart a particular simulator given the udid.

I have tried shutdown and then boot the simulator using

$ xcrun simctl shutdown <udid>
$ xcrun simctl boot <udid>
$ open -a simulator

but the simulator hangs after the execution of these commands.

Xcode version: 10.3 Simulator version: iPhone XS iOS: 12.4

like image 331
PR3DATO Avatar asked Oct 25 '25 14:10

PR3DATO


1 Answers

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.

like image 147
alexrogers Avatar answered Oct 27 '25 12:10

alexrogers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!