84

I'm working with xcode 5, and often get The Simulator can't be launched because it is already in use. when it's not running or open (i.e. after i do: quit simulator).

I stopped the application & don't have any other project that is open, running or using the simulator (please avoid these kind of suggestions).

this happens after i get and exception.

how can I "free" the simulator process without having to reboot my computer (right now that is the only solution i found) I've tried:

  1. simulator -->services-->a reset content and settings
  2. closing xcode and re-opening
  3. xcode --> developer toos --> simulator -->(open the simulator) quit simulator
  4. Activity monitor --> (the simulator is closed so nothing here to force close)

also the exception is not getting caught in any of my try catch so i wondering if which tool from the developer instrument can help me figure out what is wrong.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Kukula Mula
  • 1,788
  • 4
  • 19
  • 38
  • I always do it by just closing the simulator app fully. .. I dont close xcode – Daij-Djan Mar 08 '14 at 08:29
  • I think, that's a common bug. Just quit the simulator and try again. – lootsch Mar 08 '14 at 08:30
  • possible duplicate of [iPhone Simulator Can't Be Lauched?](http://stackoverflow.com/questions/7947710/iphone-simulator-cant-be-lauched) – tonymontana Mar 08 '14 at 10:41
  • 2
    @MrVincenzo **this is not a duplicate**, as mentioned above,I only have one project open in xcode, and it's not running (cause i pressed the stop button). – Kukula Mula Mar 08 '14 at 12:21
  • Have you found a solution to this problem yet? It's frustrating. It only goes away after restarting Mavericks ... – nmdias Apr 04 '14 at 09:38
  • @nmdias : quit xcode/ simulator and reopen again... that is the only weird solution... – Fahim Parkar Apr 30 '14 at 06:40
  • @FahimParkar like all the solutions posted in the question, and other similar, I tried that. It seems to be fixed now with version 5.1.1 (5B1008) – nmdias Apr 30 '14 at 08:14
  • The problem is solved here.... http://stackoverflow.com/questions/22266953/the-simulator-cant-be-launched-because-it-is-already-in-use – Narasimha Nallamsetty Aug 10 '14 at 19:37

14 Answers14

150

I got the solution..

  1. First of all quit your simulator.
  2. And then quit and restart Xcode.
  3. And then run your project.

I hope it will help you...

Almo
  • 15,538
  • 13
  • 67
  • 95
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
  • 29
    I was able to get it working with just a regular quit of xcode, not a force quit, for what it's worth. – Scott Allen Apr 22 '14 at 01:50
  • 2
    @zszen Yes, I know its not a valid solution. It's a bug in xcode. – Dharmbir Singh Apr 24 '14 at 04:11
  • 1
    Yes this works, sadly I was hoping for a solution that did not require restarting xcode given you lose your undo stack. – strange May 04 '14 at 15:21
  • @DharmbirChoudhary simulator is the fast way for debug app. It don't mention resource sync problem. Ok, if don't mind resource sync problem. the real device debug is nice. but slow ~~~~~~~ – zszen May 16 '14 at 03:17
  • But not the prominent one, some times we need crtl+z but as we have restarted our Xcode, we can't do that. – rptwsthi May 20 '14 at 06:05
  • This happens to me fairly often, I find if I quit the simulator then clean the project it usually works. – Paul May 21 '14 at 16:10
  • But.. I am afraid quitting Xcode will devoid me of any code changes I have to put back (cmd + z).. Especially when there are several changes in different files.. There has to be a different solution..!!! Unfortunately, only this works. – Revanth Jun 06 '14 at 13:09
  • @Revanth Yes. There should be different solution. But this is bug. So we can't do anything. – Dharmbir Singh Jun 06 '14 at 13:24
  • I have to keep redoing this every single time this message comes up, which is about 1/3 times I try to run my code. Agh! – sudo Jul 08 '14 at 18:43
  • Can someone make script to force quit Xcode & simulator from console, or something? – Valerii Pavlov Oct 07 '14 at 12:01
  • This works for me, but with a ginormous code base, starting xcode takes minutes... sadnesss... – Amir Memon Oct 27 '14 at 18:27
  • #4. Restart your machine ;) – i-- Apr 15 '15 at 16:31
6

Restart xcode and the simulator. It's a bug.

Patrick Collins
  • 4,046
  • 3
  • 26
  • 29
4

What might be going on here is that you've terminated the simulator, but you haven't actually terminated the debug session that Xcode still has open with the simulator. You'll notice that the stop button still appears in the top left. The debug session remains open because you never continued from the exception you hit.

You'll be able to kill the debug session by pressing the stop button, or by pressing command+period. After that, you'll be able to build to the simulator again.

Eagerod
  • 811
  • 9
  • 11
  • 1
    This may be the case, but not always. I just had the "simulator cant be launched" error after stopping the simulator without hitting any breakpoints or any exceptions. It looked like a clean close. The stop button was disabled and the debug menu (Pause, Continue etc) was disabled, because I was no longer debugging. Only closing Xcode and the Simulator helped. – Phil_12d3 Aug 04 '14 at 16:14
4

Once we get the error of "Simulator in Use", we will be left with no other option than quitting the Xcode and so the changes made in the code cannot be undone.

The only solution which I came across, is to make a habit to_

  1. Clean the Project twice or more times

  2. Reset the simulator before running the project.

And the worst part of this solution is to follow this procedure each time before you want to run the project in simulator.

But it does not require to Force Quit Xcode and so this atleast allows us to undo the changes in the code.

Can't help it fellas...

This Bug needs to be resolved by apple, I guess...

2nd September,2014.

I am not facing this problem since i updated my Mac OSX and Xcode. Seems like it is fixed by Apple.

Thanks fellas.

Piyush Mathur
  • 1,617
  • 16
  • 33
  • I still get this - 27th Jan 2015. Latest Xcode, latest OS X. – djbp Jan 27 '15 at 16:11
  • I don't know why, but i stopped getting this maybe because I made a practice of deleting derived data regularly before starting it everyday and resetting the simulator everytime I run my project. – Piyush Mathur Jan 27 '15 at 16:18
2

Try doing a reset content and settings

iOS Simulator menu › Reset Content and Settings…

Slipp D. Thompson
  • 33,165
  • 3
  • 43
  • 43
anuj
  • 1,010
  • 2
  • 11
  • 26
2

You just need to close XCode and the iOS Simulator apps. Then restart XCode. That's it.

diegomercado
  • 177
  • 1
  • 5
2

You can also fix this by clicking stop button ( next to play button ) on upper left part of xcode. The problem is the simulator is / may be stopped but the debugger is still running on the file. So instead of restarting xcode, just click stop button.

cheers

ralphgabb
  • 10,298
  • 3
  • 47
  • 56
1

Check if another instance of Xcode uses the simulator. If so just stop the running application by pressing the rectangle on the top left corner of Xcode. It always happens to me because I forget to close the application that is running.

arniotaki
  • 2,175
  • 2
  • 23
  • 26
0

Check the dock of MacOS, can you find the the simulator icon? Then to check the bottom of the icon whether there is a white line or a white point. If you dock is not at bottom, check the left or right side of the icon whether there is a white line or a white point. If have, the simulator is already in use. You should click on the simulator icon, then press cmd+Q to quite it.

simalone
  • 2,768
  • 1
  • 15
  • 20
0

I tried above all but they could not help me to solve my issue. I removed the Xcode and installed it again then the problem is solved.

Make sure that you have installed Xcode properly otherwise Xcode will not work properly.

Narasimha Nallamsetty
  • 1,215
  • 14
  • 16
0

I think it a bug in Xcode 5.1

and i use this solution for this issue. "Close all application from background and then run"

To close application from background use,

Select simulator then press "Ctrl+Shift+H+H" So it open background task screen in this close all application from background and then run your application from Xcode.

i hope this will solve you lots of time of restarting the Xcode.

Ayaz
  • 1,398
  • 15
  • 29
0

I hav the same problem. My way to slove it is simple: select the correct simulator from simulator's menu->hardware->device. seems the problem is becasue the simulator device didn't fit the scheme device in the xcode project.

highwing
  • 111
  • 5
0

Check every project window, click "Stop running" button on the top left of XCODE.

Gank
  • 4,507
  • 4
  • 49
  • 45
0

No need to stop Simulator. * Stop debugging all other projects in Xcode. * Now Run your desired application.

This worked for me.