DEV Community

ochieng seth
ochieng seth

Posted on

How to run a react-native app on a real device using terminal

๐Ÿ‘‹๐ŸฟJambo folks,
Constantly opening Xcode to build your app on a real device is a pain, open your terminal and lets' dive right in.

Step 1

  • For whatever weird reason you don't have it yet, install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2

  • install ios-deploy

brew install ios-deploy

now what you have been waiting for ๐Ÿ˜›

  • connect your device via usb (of-course) then in terminal,

ios-deploy -c

The result will be

Found 7875****************** (D20AP, <iphone version>, iphoneos, arm64, 1543) a.k.a. '<device name>' connected through USB.

  • copy the 7875******************
  • now lets build the app with

npx react-native run-ios --udid 7875******************

Hope it helps๐Ÿ˜Š

Discussion (1)

Collapse
coucoseth profile image
ochieng seth Author

new method is npx react-native run-ios --device="[DEVICE_NAME]"