Bomber
Bomber

Reputation: 10947

Build error domain=com.apple.CoreSimulator.SimError, code=405

I can build on my iOS 15 emulator with no problems, but when building on my iOS 15 Device connected to xcode 13. I get the error:

error Failed to launch the app on simulator, An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: Shutdown.

Any ideas?

Console:

success Successfully built the app
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, id:CECA2B5E-D9A0-4A52-8947-BF0838EBEDD6, OS:15.0, name:iPhone 8 }
{ platform:iOS Simulator, id:4B8F148A-C39B-42B8-B982-82759A99BAF9, OS:15.0, name:iPhone 8 Plus }
{ platform:iOS Simulator, id:8853D49D-06EB-4542-AE09-EFD94DC045D6, OS:15.0, name:iPhone 11 }
{ platform:iOS Simulator, id:1F7B80D0-0CFE-4D4F-AF69-260D8F0D785C, OS:15.0, name:iPhone 11 Pro }
{ platform:iOS Simulator, id:7AF2F670-7D7B-4C0D-B1A2-DDD9A8DC0554, OS:15.0, name:iPhone 11 Pro Max }
{ platform:iOS Simulator, id:5A36169B-4CE3-4E54-AC1D-8E2550EAAF61, OS:15.0, name:iPhone 12 }
{ platform:iOS Simulator, id:DA7C5083-DE28-40C8-83D3-7BA678311561, OS:15.0, name:iPhone 12 Pro }
{ platform:iOS Simulator, id:C012CD47-9A6D-4B88-B209-4777EE57BD2A, OS:15.0, name:iPhone 12 Pro Max }
{ platform:iOS Simulator, id:3C64ECA5-9EE0-4D2C-A0C9-82CAD36AE094, OS:15.0, name:iPhone 12 mini }
{ platform:iOS Simulator, id:DBA58C7D-41CB-44B2-99FA-F07E5CB829B5, OS:15.0, name:iPhone 13 }
{ platform:iOS Simulator, id:B43092DC-8F33-47BD-8429-A4D35C7FD7B8, OS:15.0, name:iPhone 13 Pro }
{ platform:iOS Simulator, id:E587AD8C-D9B6-4683-9251-6D0F5DF50A57, OS:15.0, name:iPhone 13 Pro Max }
{ platform:iOS Simulator, id:1A7AC21A-A578-40A7-9C81-53B7F90CAED6, OS:15.0, name:iPhone 13 mini }
{ platform:iOS Simulator, id:352BE540-010B-4A15-B67D-965A884BB20D, OS:15.0, name:iPhone SE (2nd generation) }
{ platform:iOS Simulator, id:24BBBFF1-FF95-453D-A952-66D3A93D611D, OS:15.0, name:iPod touch (7th generation) }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:75F7457E-C581-4247-A1DC-E92CA319A693, OS:15.0, name:iPad (9th generation) }
{ platform:iOS Simulator, id:1482EAA0-8637-4D49-A091-B604208127BB, OS:15.0, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:38D1E279-3D1E-4248-8B9D-76A3480D1CF0, OS:15.0, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:54079569-B96E-4570-A076-732A2DED9E49, OS:15.0, name:iPad Pro (11-inch) (3rd generation) }
{ platform:iOS Simulator, id:A0CBCD90-C028-420B-9D6F-07E6EDA643FC, OS:15.0, name:iPad Pro (12.9-inch) (5th generation) }
{ platform:iOS Simulator, id:E034D4B3-770E-4AD1-8573-DF7984340F16, OS:15.0, name:iPad mini (6th generation) }
info Installing "/Users/mattharris/Library/Developer/Xcode/DerivedData/myracnative-glxuojrfejxbhqgircpjgklctbto/Build/Products/Debug-iphonesimulator/myracnative.app"
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405):
Unable to lookup in current state: Shutdown

Upvotes: 89

Views: 72242

Answers (16)

Aurélien Caraty
Aurélien Caraty

Reputation: 359

In my case I had the simulator still running in background (the icon was displayed in the dock with the white dot). I forced kill it and everything worked again.

Upvotes: 2

mikrich
mikrich

Reputation: 61

I was getting this error trying to run a react native app using react-native run-ios. The following fixed it form me:

sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

I was seeing a slightly different error when building in Xcode which led me to this: https://forums.developer.apple.com/forums/thread/735155

Upvotes: 1

Vitor Imbroisi
Vitor Imbroisi

Reputation: 1

In my case, I saw the logs and then I saw that the problem was with my "location" was activate. I change to none and them it worked.

Upvotes: 0

Green
Green

Reputation: 1741

This instantly fixed the error for me:

  1. Quit the simulator
  2. Go to menu bar and click Apple icon > About this Mac > Storage > Storage Settings > Developer
  3. Delete XCode Cache
  4. Re-run npx react-native run-ios

Upvotes: 40

Vicktor
Vicktor

Reputation: 368

Even after deleting the Xcode cache, I still couldn't open the simulator.

For those who even don't know how to see the logs, here's how you can do so.

  1. Open the Finder and go to your home file (it's the one with the home icon next to it in the sidebar where most of your stuff will most likely be stored).
  2. Press Cmd + Shift + . to see the hidden files and open the 'Library' file.
  3. Click on Logs -> Core Simulator -> CoreSimulator.log.

~/Library/Logs/CoreSimulator/CoreSimlator.log

While in the 'Library' folder, navigate to the 'Core Simulator' folder where you'll see the 'Caches' folder.

~/Library/Developer/CoreSimulator/Caches

Deleting this 'Caches' folder worked for me.

Here's a helpful Medium article on some other things to try should you still have problems.

It helped me out immensely.

Upvotes: 0

404notBrighton
404notBrighton

Reputation: 170

Try this Solution

  1. Click the apple icon top left corner
  2. Select About this Mac
  3. Select Storage Click Manage
  4. Select Developer on your left
  5. Lastly delete Build and indexes just under Xcode Project Build files

Upvotes: 2

chenop
chenop

Reputation: 5143

I saw the dot near the simulator (meaning it was active) but it did not open.
What helped me was doing:
Right click the simulator --> Device --> choose one.
that opened it.

Upvotes: 0

SimonEritsch
SimonEritsch

Reputation: 1307

Very weird behavior in my opinion, but I tried everything and I finally found the solution.

The problem was due to me changing my email address of my apple id. Seems like the Simulator tries to use the apple id internally and thus - if it cannot connect - does not boot correctly.

After fixing the email address in XCode -> Preferences -> Accounts (i just added the new email address and removed the old one) everything works again.

Upvotes: 0

Fotios Tsakiris
Fotios Tsakiris

Reputation: 1556

Solutions:

  1. Just quit the Simulator, and then run again react-native run-ios.

  2. If, during the build, you get e.g. info Launching iPhone 13 (iOS 15.5) but the simulator does not open, do the following: Before the build is finished, right-click the simulator icon and go to Device and choose the device the build says it is going to build it on.

Upvotes: 25

Idan
Idan

Reputation: 4023

Open xcode go to -> preferences -> Locations

and set Relative in Derived Data:

enter image description here

Upvotes: 1

Zdeněk Dolák
Zdeněk Dolák

Reputation: 39

Make sure you have another simulator somewhere in the background, that was my problem after all.

Upvotes: 1

DYS
DYS

Reputation: 3053

To fix it, I simply select a specific iOS simulator and it runs successfully.

npx react-native run-ios --simulator="iPhone 8"

Upvotes: 20

Hanchen Jiang
Hanchen Jiang

Reputation: 2682

I got this error when the simulator is already open while I ran react-native run-ios. Closed the simulator all the way. Reran the command and it worked.

Upvotes: 99

Bandish Kumar
Bandish Kumar

Reputation: 2248

Please follow these steps:

Go to about this Mac -> Then Select Storage -> Select Manage -> Developer -> then Delete Project Build Data and Indexes.

It will work:

npx react-native run-ios --simulator="iPad Pro (9.7-inch)" 

attaching a screenshot for reference: enter image description here

Upvotes: 14

Soju Tom
Soju Tom

Reputation: 944

Delete Xcode cache

Delete Project Build and indexes

Path:> about this Mac>Storage>Manage>Developer

Screen

Upvotes: 92

do you run your code in an IDE? I faced the same problem today after updating XCode. If I run code in terminal I get other error: CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler Try this

sudo xcrun simctl shutdown all && sudo xcrun simctl erase all

More about https://developer.apple.com/forums/thread/653807

Upvotes: 10

Related Questions