The short answer
For a React Native project with native code, installing iOS dependencies, compiling and archiving all have to be done on macOS; the official environment documentation lists the iOS target on Windows and Linux as unsupported. JavaScript business code can still be written on your usual computer. If the project uses Expo the situation is different: cloud builds work without a Mac of your own.
Which steps require macOS
Steps that need macOS
- Installing CocoaPods dependencies under
ios/, and opening the.xcworkspacein Xcode to compile. - Archiving and exporting: the official publishing documentation does all of it inside Xcode and gives no single command that outputs an .ipa.
- The
Bundle React Native code and imagesphase of the build: an Xcode build script calls Node to bundle the JavaScript into an offline bundle.
What you can finish on Windows / Linux first
- All JavaScript / TypeScript code and debugging of the Android version.
- Upgrading
package.jsondependencies and the lockfile. Note that after a native module is upgraded, the iOS side has to go back to the Mac to reinstall Pods.
The official React Native environment documentation says it plainly: building a project with native iOS code requires a Mac. The other route it points people without a Mac to is Expo.
How to do it on a remote Mac
Install Node and Watchman
Your account on the remote Mac is an admin account, so you can install Homebrew. The commands in the official documentation are:
brew install node brew install watchmanThe documentation sets a minimum Node version; take the exact number from the official page. Try to keep the same major Node version as your everyday development machine to reduce lockfile differences.
Install Xcode, the command-line tools and CocoaPods
Install Xcode from the App Store. Open it, go to Xcode Settings → Locations, and select the latest version in the Command Line Tools dropdown; skipping this leaves the command line unable to find the compiler. CocoaPods is a Ruby gem. The official documentation suggests installing it with the Ruby that ships with macOS; see the CocoaPods getting started guide for the exact command.
Pull the code and install dependencies
Clone the repository on the remote Mac, install the JavaScript dependencies first, then go into
ios/and runpod install(if the template project includes a Gemfile, follow the template README). From then on always open the.xcworkspace, not the.xcodeproj.Fix Xcode not finding Node
This pitfall is specific to React Native: Xcode's build scripts run in their own environment and cannot read the PATH from your terminal. The
.xcode.envfile in the template sets the path to Node throughNODE_BINARY. If you use nvm, the official documentation suggests putting the nvm initialisation lines in~/.zshenvso Xcode can find it too.Switch the run configuration to Release
Following the official publishing documentation: Product → Scheme → Edit Scheme, select Run on the left, and change Build Configuration to
Release. A Release build turns off the developer menu and bundles the JavaScript into the app, so it does not need a development machine attached after installation. To check Release behaviour on the simulator first, you can use:npm run ios -- --mode="Release"Archive and export
In Xcode set the run destination to Any iOS Device (arm64) and click Product → Archive. When archiving finishes, in the window that appears click Distribute App → App Store Connect → Upload, choosing automatic or manual signing as needed. The uploaded build then appears under TestFlight in App Store Connect. If you only want the .ipa file without uploading, pick the export-type option in the same distribution flow; its name depends on the current Xcode.
FAQ
Why is the Archive button greyed out?
The run destination is set to a simulator. Archive only becomes available after you switch the destination to Any iOS Device (arm64).
The build fails at "Bundle React Native code and images". Why?
Mostly because Xcode could not find Node, or the JavaScript itself failed to bundle. Check NODE_BINARY in .xcode.env first, then start the bundler on its own in a terminal to see whether there are syntax or dependency errors.
Can I build purely from the command line, without the Xcode interface?
The official React Native documentation gives no such command. A common approach is to script archiving and exporting with xcodebuild or fastlane; take the parameters from their respective official documentation. We suggest getting it working once in the graphical interface before scripting it.
Is it worth migrating to Expo just for this step?
It depends on the project. Expo's cloud builds work without your own Mac, but a project that already has a lot of custom native code is costly to migrate. If you only package occasionally, either renting a remote Mac or using a cloud build service will do; the comparison is in remote Mac or cloud build: which to choose.
Related
- How do I debug React Native iOS on the simulator and a real iPhone without a Mac?
- How do I sign an iOS app and upload it to the App Store from a remote Mac?
- Remote Mac vs GitHub Actions macOS runner or Codemagic: which should I use?
- How do I publish an app to the App Store without a Mac?
- iOS without a Mac: a remote Mac mini can build, sign and upload, but not debug on a real device
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support