76

I am new in expo and react-native Whenever i run the app from IOS simulator (inside expo) it always boots up the IphoneX. If i need to change the simulator,I have to open it through Xcode, is there any way we can change the default simulator ?

14 Answers 14

216

expo included an option in recent commits regarding this issue.

now you can tap shift+i on terminal which expo server is running.It will list all simulators and you need to select your choice.

https://github.com/expo/expo-cli/pull/2541

2
  • It doesn't work until I clean the expo cash with expo start -c, as @jonathan-sanchez said.
    – Arthur
    Commented Feb 25, 2022 at 11:01
  • 3
    Shift + ı for Turkish keyboard
    – feyyum
    Commented Mar 7, 2023 at 23:10
56

Currently there is no way of changing the simulator from Expo. Expo just uses the last opened simulator in Xcode.

If that doesn't work, try this (updated here from my comment) :

  1. When the simulator is open click on Hardware>Device> Select the other iphone.

  2. Now both will be open. Next exit the simulator from the dock.

  3. Now try and open your project in the ios simulator from expo. It should open in the Simulator you selected from the hardware menu.
2
  • 2
    No, it doesn't my last phone is always iphone6 but it opens iphonex Commented Dec 8, 2017 at 11:33
  • 1
    This didn't work for me. Added answer for the method that did, see "Change the iOS simulator device that is open, and Expo will use it." Commented May 22, 2019 at 15:43
55

This worked for me on Feb 2021

on Mac OS with Big sur, expo v4.1.6

  1. Clean your EXPO cache with expo start -c (on your project location)
  2. In the expo terminal press shift + i (see screenshot below)

List item

  1. Then press shift + i and you should be able to select the Simulator by pressing enter on the one you need (see screnshot)enter image description here

lastly Just wanted to share all the available options if you just press i in the metro terminal window.

enter image description here

1
  • for me at least, I didn't need to clear the expo cache. Just shift-i in the terminal was enough. Thanks! Commented Mar 16, 2021 at 10:39
12

It is possible, but you can't target it from the command line. Expo will just target the last opened simulator.

  1. Click on Hardware > Device and choose the device you desire

  2. You now have two simulators open, make sure the one you want is active.

  3. Now quit the simulator app with Command + Q

  4. Now in your command line, when running the expo server, just click i

  5. The simulator will open with your targeted device.

4

(As of December 3, 2020)

  1. Open Simulator
  2. Click on File ... (in the top-left menu bar)
  3. Click on Open Device ... (in the drop down list)
  4. Select your desired device and let it launch completely
  5. Quit Simulator ... (command + Q)
  6. Done

Running your app on iOS Simulator will automatically launch to this desired device now =)

3

Change the open iOS simulator device(s), and Expo will use it.

Expo directs its output to the open iOS simulator, so this must be done in the simulator itself rather than in Expo. It is simple to do. You can direct expo output to different devices. Here's how. BTW, other approaches described here didn't work when I tried them.

Open a second simulator in iOS Simulator by:

1) select eg Simulator->Hardware->Device->iOS12.1->iPhone 8

2) Select the simulator that you don't want to use (eg the current default as of writing, iPhone XR). Press Command-W to close the simulator window, leaving the iPhone 8 simulator still running.

3) In Expo, deploy the code to simulator as usual, either using the i at the command line, or selecting 'run on iOS Simulator' from the browser version of Expo.

4) It is possible to get expo to display to more than one simulator that is running at once (eg to test rendering on multiple screen sizes). Once you get expo running on one device (steps 1-3), you can repeat on an additional device (or presumably more). Expo will then be running on multiple simulators. They will simultaneously display the output. When I change my code, it immediately updates to multiple simulators/screen sizes without requiring any additional steps. Haven't re-tested exactly the order of steps to do this most easily, but it's working.

Hope this works for you!

2

Go to /Users/username/.expo/ios-simulator-app-cache/ and remove all files in there.

Run the ios simulator you want and run your expo project.

1

You just need to open the desirable simulator through Xcode, and then just run: npm run ios
from your project directory or a similar command to start your app

1

I believe that yarn passes unrecognized arguments through to react-native run-ios, so you should be able to pass --simulator="foo" as described here: https://facebook.github.io/react-native/docs/running-on-simulator-ios.

1

I know the exact answer Once you open the Simulator from the Expo, go to Help menu and Search for "iphone11", "iphoneX" .... Then you should be fine

2
  • 2
    Just to clarify, using the top menu, go to File > Open Device and then select the device. Commented Aug 19, 2020 at 15:59
  • Yes you are also right, I am using Mac that's why I said in different way
    – Guvanch
    Commented Aug 25, 2020 at 1:59
1

Restarting the computer was the only thing that worked for me. Without it pressing "Shift+i" had no effect. Neither Expo client would be installed on new simulator instance.

This was on macOS and M1 MacBook Pro for me.

1
  • 1
    Closing the active simulator (close window ⌘W) -> Opening the one I want -> Restart worked for me.
    – alpere
    Commented May 7, 2021 at 12:59
1

You will likely get this error message: "No development build for this project is installed. Please make and install a development build on the device first." if you use the command expo start and then choose a device using +i.

Instead, the quickest solution to switch simulators AND get the build on the device is:

expo run:ios --device

This will then prompt you with a list of simulators, and after making a selection it will install the build and run it.

1
  • This was the only solution I've seen so far that worked for choosing the physical device and not just the simulator! Shift + i only listed simulators
    – Zout
    Commented May 7 at 18:50
0

It would help if you launched your simulator on your specific device, or you can run this command:

npx expo run:ios --device "iPhone X"
-1

Just launch simulator on which you want to run app and then run command i.e. "yarn run ios" or "npm run ios" to run on simulator. App will run on both simulator.

If it doesn't work then quit all simulator and then run the command i.e. "yarn run ios" or "npm run ios", then app automatically run on simulator which was latter launched.

Hope this may help you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.