54

I am facing this problem again and again. Anybody can give the solution to this problem except reboot the Mac?

I have already tried these tricks

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

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

  1. Restart xcode and the simulator
Tasawar Hussain
  • 650
  • 7
  • 21
nitin.agam
  • 1,949
  • 1
  • 17
  • 24

11 Answers11

103

I also have this issue and googled this, which redirect to this question. Mine was xcode10 What i have done is as follows

  1. Quit the simulator & Xcode.
  2. Opened Activity monitor, selected cpu option and search for sim, killing all the process shown as result.
  3. Then fired up the terminal and run sudo xcrun simctl erase all. It will delete all content of all simulators. By content if you logged in somewhere password will be gone, all developer apps installed in that simulator will be gone.

Doing these resolved my issue.

starball
  • 20,030
  • 7
  • 43
  • 238
Ratul Sharker
  • 7,484
  • 4
  • 35
  • 44
  • I've had the same problem when both Xcode 10 and 9 were installed. The error message was: "Device iPhone XS Max is available but has no defaultDisplay". Thanks for the solution! – Alexander Oct 12 '18 at 04:32
  • 5
    For me it worked even without step 3. It helped just to remove all the `launcd_sim` processes (I had several), all the dependent ones removed automatically. Thanks for an answer! – topolog Oct 17 '18 at 11:52
  • 3
    Works fine for me with the above mentioned steps, thank you so muc – iOS dev Oct 23 '18 at 11:30
  • 1
    Shutting down and restarting after step 2 helps. Sometimes the sim processes don't quit and this will ensure that they do. – QualiT Mar 17 '20 at 21:31
  • Thanks a lot for the solution. This fixed the problem. I have 2 Xcode versions installed so maybe it was causing some issues with the Simulator runtime. I guess removing the data and processes fixes the issue. – AJ7 Dec 22 '20 at 08:04
  • This works for me too, though after stressing myself by unistalling and re-downloading xcode – Toby William May 10 '23 at 13:47
44

Under Product -> Scheme -> Edit Scheme, check these settings once.

Right now it is showing None. That is NOT what you want. Choose the Executable from the dropdown. It should have something like: <app_name>.app.

Edit scheme window screenshot

Ishan
  • 3,303
  • 5
  • 29
  • 47
swapnilagarwal
  • 1,126
  • 8
  • 16
  • 2
    To find the Run Window go to Product -> Scheme -> Edit Scheme – Leo Caseiro Jul 01 '16 at 06:37
  • 30
    your screenshot does not explain nothing. very poor answer. you need to tell people what to do there, namely SELECT EXECUTABLE, because you have None right now that is why Simulator does not start. – Boris Gafurov Apr 10 '18 at 23:56
  • well I had more serious problem as my simulator just crashes at start since I had two versions of Xcode installed. Tried restart my laptop before without help. Today I just tried the solution here, by just checking at the Edit Scheme once without changing anything, then restarted my laptop again, now both Xcode versions simulators work. Maybe a coincidence, but I'll give you credit here :) – CodeBrew Sep 24 '18 at 14:41
  • Under Product -> Scheme -> Edit Scheme, check the Launch option, it should be selected Automatically – Ajumal Sep 09 '20 at 18:02
  • im here to thank you for the answer <3 – esen Sep 02 '22 at 14:47
15

None of the above solutions helped me.

I also tried

sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService

And even after clean Xcode reinstallation my simulators continue closing after launching.

So i removed all simulators from Window - Device & Organizers Remove all simulators

And then added new one's

Add new simulators

And the problem has gone

Mikhail Vasilev
  • 720
  • 6
  • 13
4

In my case tmp directory was not there for some reason, creating it giving adequate permissions saved my day.

sudo mkdir /private/tmp
sudo chmod 1777 /private/tmp

https://stackoverflow.com/a/48075384/6919038

Tasawar Hussain
  • 650
  • 7
  • 21
0

In Xcode select Product > Scheme > Edit Scheme > Run > Options tab.

Confirm Launch due to a background fetch event is not selected.

See the image below ...

enter image description here

Vipin Johney
  • 1,315
  • 14
  • 21
0

Enable/change location in the xcode console. It worked for me.

Narasimha Nallamsetty
  • 1,215
  • 14
  • 16
0

The following solved my issue

  1. Open edit scheme

Open edit scheme

  1. Check that lunch is automatically

Check that lunch is automatically

0

I was having this behavior in xcode 14.2, visual studio 17.5 preview 6. The folders previous posts refer to are not there to delete. In my case, I finally discovered that after rebuilding certs due to the main apple cert expiration on Feb 6, 2023, the project had chosen the distribution cert for use in simulator. I had to remove the account, re-add it, and then the developer cert would show, but it would de-select itself oddly enough. I finally set it, closed the properties, and it stuck... after which the simulator came right up. Hopefully that saves someone some time.

0

I tried all methods above and still had the same error. Since its the simulator causing a mess , i just created a new project on Xcode and just chose new device and when device was powered on i launched my expo project and it worked

0

In my case, was just kill the process: sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService

-1

Long shot but in my case I just moved my Xcode to Applications and restarted Xcode.

Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62