Run a React Native iOS release build from terminal

Sandro Machado picture Sandro Machado · Oct 28, 2016 · Viewed 37.3k times · Source

I am trying to run the release build directly from the terminal and I did not found an option to do that.

From XCode what is required to do is:

Product -> Scheme -> Edit Scheme (cmd + <), make sure you're in the Run tab from the side, and set the Build Configuration dropdown to release.

http://facebook.github.io/react-native/docs/running-on-device-ios.html#building-your-app-for-production

There is any option available from the react-native-cli to do the same? Something like react-native run-ios -configuration Release?

My objective is to generate a build that does not require the server being running to provide to the QA team for instance.

Answer

Sandro Machado picture Sandro Machado · Nov 10, 2016

I did a PR to the React Native project to allow this feature. The PR can be check here: https://github.com/facebook/react-native/commit/ca7cbdee858e84c4a74a2d9c7be151f5cfdcfbfe

So, in the future, to run a release build from terminal you just only need to type the following command: npx react-native run-ios --configuration Release

If you want run your project on a real device use --device parameter:

npx react-native run-ios --configuration Release --device "Your Device Name"