kill iOS Simulator from terminal

19,964

Solution 1

Use killall "iPhone Simulator"

With XCode 6, use killall "iOS Simulator" (thanks @gempewsaw)

With XCode 7, use killall "Simulator" (thanks @Stanislaw)

With XCode 8, killing the Simulator process is sometimes not enough, also need to kill process com.apple.CoreSimulator.CoreSimulatorService (thanks @bensnider)

Solution 2

The proper way to shutdown simulators is xcrun simctl shutdown all.

I don't recommend shutting down simulators by killing CoreSimulator.

Simulator.app is just a viewer (as of Xcode 9). It does not need to be launched and so does not need to be shut down either. It will respond to devices booting and shutting down automatically.

You can also hold down Option when quitting to detach from running simulators without shutting them down. Check the checkbox to make that the default behavior.

Similarly you can hold down Control when closing a window via File, Close to get a similar choice when closing a single simulator's window.

Solution 3

I agree with the answers above. Just wanted to add that I noticed my Jenkins job was failing when there was no simulator to kill. I got around this by adding it like this:

killall "iOS Simulator" || echo "No matching processes belonging to you were found"

Good luck with your ci!

Solution 4

Please try

killall -9 "iPhone Simulator"
Share:
19,964
Claus
Author by

Claus

Updated on June 04, 2022

Comments

  • Claus
    Claus about 2 years

    I'm trying to terminate the iOS Simulator from the terminal console (needed for integrating automatic UI Testing in Jenkins),but every time I try the command:

    killall SimulatorBridge
    

    a prompt waiting for action gets displayed: enter image description here

    The problem is that the simulator doesn't get dismissed until an action on the prompt is taken. How to get rid of it?

  • gempesaw
    gempesaw over 9 years
    on mavericks with xcode 6.1, I had to do killall "iOS Simulator". Thanks for the starting point :D
  • bensnider
    bensnider almost 8 years
    On Xcode 8 killing the Simulator process is sometimes not enough. I also have to kill the process com.apple.CoreSimulator.CoreSimulatorService.
  • Michael Eakins
    Michael Eakins over 5 years
    How this isn't the best answer is beyond me. +1 for simplicity!
  • SushiHangover
    SushiHangover about 5 years
    This should be the accepted answer in 2019... (FYI: if running Xamarin-based UITests or remote simulator, add sudo as processes are not owned by "you")
  • Charles Offenbacher
    Charles Offenbacher about 5 years
    These answers look good for legacy but for 2019 xcode 10 I had to use stackoverflow.com/a/54359898/573180
  • Maboo
    Maboo about 4 years
    The solution that should popup as first result for any search of this question. +1
  • minusf
    minusf over 3 years
    too bad sometimes it still leaves some com.apple.CoreSimulator.CoreSimulatorService running...
  • russbishop
    russbishop over 3 years
    Yes, CoreSimulatorService manages the database of simulators among other things. You shouldn't be killing it. The service restarts automatically when upgraded. You are likely to cause random problems by killing it.
  • A. K.
    A. K. almost 3 years
    This should be the answer. I should have found this earlier, that would have saved me a ton of time and some embarassment. One of the scripts went berserk and launched a ton of simulator instances and no bash magic would work unless I just restarted my computer.