React Native `RuntimeError: abort(Error: xcrun exited with non-zero code: 2` on iOS simulator

Viewed 4848

I was working on a React Native project with a group and was asked to use the iPhone 13 simulator as a model while working. I only had access to the iPhone 12 simulator, and I saw that my XCode was a version behind, so I updated it. Now with the new XCode, I am getting an error when I start the React Native server and try and open the iOS simulator. the error is shown below:

error code in console

Running this command with the suggested build with -s Assertions=1 reveals the following:

result of build command with flag

My package.json is as following:

packagejson file

Any idea what is going on or how to proceed? Expo seems to be able to run, but trying to open the simulator crashes the server. The project I am on is near tight deadlines and I am totally held up by this. Either a way to troubleshoot this error or a way to roll back my XCode install and just live with a dated simulator would be greatly appreciated.

5 Answers

Figured it our thanks to ShepSims from https://github.com/expo/expo-cli/issues/2413 . Before being able to open the iOS simulator from the terminal, I needed to open XCode and open the simulator there. This mounts the simulator bundle, allowing later access by pressing i after running expo start.

I was receiving the same error as above with XCode command line tools installed only, no XCode installed.

I tried re-installing XCode command line tools which didn't do anything.

For me this was solved with advice mentioned at https://github.com/expo/expo-cli/issues/3871:

  • open Simulator.app, as it automatically sets the default device.

It is not anything. It was solved by opening simulator from XCOde on my mac

The fastest way from my point of view is "spotlight" (Cmd+Space) search for "Simulator", hit enter before running "expo start" in your terminal.

You can solve the problem by using this command

sudo expo start

Or

manually open simulator

start app: react-native run-ios

manually do: Hardware -> Device -> select iOS -> select Device (different than before !)

that will open a second simulator

start the app again: react-native run-ios (expo start then press i)

this opens the app in the selected simulator

Note:- please stay open the silumater then press the i in the expo and same for the react-native run-ios command

Related