Back

How to Run React Native Apps on a Specific Device in the iOS Simulator

Josh BucheaMonday, February 10, 2020
It can be frustrating when the officially recommended method for doing a thing doesn’t work. Here are some steps and commands to help you get your React Native app running on your preferred device in the iOS Simulator:

It can be frustrating when the officially recommended method for doing a thing doesn’t work. Here are some steps and commands to help you get your React Native app running on your preferred device in the iOS Simulator:

The React Native Docs recommend using the --simulator flag with react-native run-ios:

react-native run-ios --simulator=”iPhone 11 Pro Max”

If you run into (like I did):

command not found: react-native

Try running the script for iOS in your app’s package.json (often it’s ios):

yarn ios --simulator=”iPhone 11 Pro Max”

In theory npm should work also, but I didn’t have any luck. Your mileage may vary:

npm run ios --simulator=”iPhone 11 Pro Max”

List Available Devices

List available iOS devices:

xcrun simctl list devices

Available devices for iOS 13.3 on my machine:

iPhone 8 (2FE6CAE2–49084464–884A-5DED11505CE4) (Shutdown) iPhone 8 Plus (F2A473F7–1F48–48DB-A6A6–584253814AA6) (Shutdown) iPhone X (8FC4167D-AC9C-4F90–825C-9FB7004D03BA) (Booted) iPhone 11 (E7885A5A-03064243-A852–8E71A7B0A5CB) (Shutdown) iPhone 11 Pro (13B1AF48-BDD5–4AD7–8D7C-F31F3CF97FF5) (Shutdown) iPhone 11 Pro Max (9C3B2313–258B-4E79–86A3–275D6BB3D078) (Shutdown) iPad Pro (9.7-inch) (1A094DA7-A246–47B7–9716–5D8A9190C563) (Shutdown) iPad (7th generation) (E0E0E252–5B96–4D2B-BD98–7D9ED79756AD) (Shutdown) iPad Pro (11-inch) (143BB411-E726404898E5-F87F04DEDCC2) (Shutdown) iPad Pro (12.9-inch) (3rd generation) (14EFAE0F-C4D249E3-B501–633CB3E7DD00) (Shutdown) iPad Air (3rd generation) (2797C8B5-E8FC-428A-AA4A-81F500153DDA) (Shutdown)

Add Devices

To add additional devices:

  1. Launch Xcode

Xcode dock icon

2. Open Devices and Simulators (⇧⌘2)

Screenshot of the Window menu in Xcode with Devices and Simulators selected

3. Press Simulators Tab

Screenshot of Devices and Simulators window in Xcode

4. Press plus “+” button in the bottom left corner
5. Choose a Simulator Name, Device Type, and OS Version
6. Press blue button labeled “Create”

Screenshot of the “Create a new simulator” dialog in Xcode

Commands for Your Convenience

Here are some commands with yarn that are ready-to-use for your convenience:

yarn ios --simulator=”iPhone 8" yarn ios --simulator=”iPhone 8 Plus” yarn ios --simulator=”iPhone Xyarn ios --simulator=”iPhone 11" yarn ios --simulator=”iPhone 11 Pro” yarn ios --simulator=”iPhone 11 Pro Max” yarn ios --simulator=”iPad Pro (9.7-inch)yarn ios --simulator=”iPad (7th generation)yarn ios --simulator=”iPad Pro (11-inch)yarn ios --simulator=”iPad Pro (12.9-inch)yarn ios --simulator=”iPad Air (3rd generation)

Note

There is currently no way to set a default device for the Simulator.

Thanks for reading!

To learn more about our React Native process at Echobind, visit our React Native capabilities page.

Share this post

twitterfacebooklinkedin

Related Posts:

Interested in working with us?

Give us some details about your project, and our team will be in touch with how we can help.

Get in Touch