React Native Setup Guide — Run Your First App on a Brand New Mac or Windows Machine
You just got a fresh machine. You need to run a React Native app. This guide takes you from zero to a running app on iOS or Android — step by step, nothing skipped.
Everything here is aligned with the official React Native environment setup docs.
Important: iOS apps can only be built on a Mac. Android works on both Mac and Windows.
On Linux? This guide focuses on Mac and Windows, but React Native works on Linux too (Android only). Follow the official Linux setup instructions.
Table of Contents
- What You'll Install
- Part 1 — Mac Setup
- Part 2 — Windows Setup
- Part 3 — Get the Code
- Part 4 — Run the App
- Part 5 — Run on a Physical Device (Optional)
- Troubleshooting
- Quick Reference
What You'll Install
| Tool | What It Does | Platform |
|---|---|---|
| Homebrew / Chocolatey | Installs other tools for you | Mac / Windows |
| Git | Downloads the project code | Both |
| Node.js (>= 22) | Runs the JavaScript code | Both |
| Watchman | Watches files for changes | Mac only |
| Xcode | Builds the iOS app | Mac only |
| Ruby & CocoaPods | Manages iOS native libraries | Mac only |
| JDK 17 (Azul Zulu) | Required by Android builds | Both |
| Android Studio | Builds the Android app | Both |
Part 1 — Mac Setup
Step 1: Install Homebrew
Open the Terminal app (press Cmd + Space, type "Terminal", hit Enter).
Paste this and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the on-screen instructions.
Apple Silicon (M1/M2/M3/M4) users — important! After the install finishes, Homebrew will print two commands under "Next steps" that look like this:
echo >> ~/.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofileYou must run both of these. Copy and paste them exactly as shown in your terminal output. Without this step, the
brewcommand won't be found.
Close and reopen Terminal after running the above.
Verify it works:
brew --version
You should see something like Homebrew 4.x.x.
Step 2: Install Git
brew install git
Verify:
git --version
Step 3: Install Node.js
React Native requires Node 22.11.0 or newer.
brew install node
Verify:
node --version
It should show v22.x.x or higher.
Using nvm instead? That works too — but you'll need an extra Xcode config step later (covered in the Troubleshooting section).
Step 4: Install Watchman
brew install watchman
Watchman helps Metro (the React Native bundler) detect file changes quickly. It's highly recommended by the official docs for better performance.
Step 5: Install Xcode (for iOS)
- Open the App Store on your Mac.
- Search for Xcode and click Get / Install (it's around 12 GB — grab a coffee).
- After install, open Xcode once and accept the license agreement.
Set the Command Line Tools:
- In Xcode, go to Settings (or Preferences) → Locations tab.
- In the Command Line Tools dropdown, select the most recent version.
Install an iOS Simulator:
- In Xcode, go to Settings → Platforms (or Components) tab.
- Click the + icon and select iOS... to download a simulator runtime.
- Pick the latest iOS version available.
Step 6: Install JDK 17 (for Android)
React Native requires JDK 17. The official docs recommend the Azul Zulu distribution.
brew install --cask zulu@17
After Homebrew finishes, it downloads a .pkg installer. You need to run it manually:
-
Apple Silicon (M1/M2/M3/M4): Open the
.pkgfile from/opt/homebrew/Caskroom/zulu@17/ -
Intel Mac: Open it from
/usr/local/Caskroom/zulu@17/
You can find the exact path in the Homebrew output after the install.
Now add JAVA_HOME to your shell config. Open ~/.zprofile (or ~/.zshrc):
open -e ~/.zprofile
If the file doesn't exist, create it:
touch ~/.zprofile && open -e ~/.zprofile
Add this line at the bottom:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
Save, close, and reload:
source ~/.zprofile
Verify:
java -version
It should show openjdk version "17.x.x".
Warning: Using a JDK version higher than 17 may cause build issues. If you must use a higher version, you'll need to update the Gradle version in your project's
android/gradle/wrapper/gradle-wrapper.properties.
Step 7: Install Android Studio (for Android)
- Download from developer.android.com/studio.
- Open the
.dmgfile and drag Android Studio into Applications. - Open Android Studio and go through the setup wizard — choose Standard install.
- Make sure these are checked during setup:
- Android SDK
- Android SDK Platform
- Android Virtual Device
Install the required SDK components:
Open Android Studio → Settings (or Preferences) → Languages & Frameworks → Android SDK.
-
In the SDK Platforms tab:
- Check Show Package Details (bottom-right corner).
- Expand Android 15 (VanillaIceCream) and check:
Android SDK Platform 35- Pick the right system image for your chip:
-
Intel Mac:
Intel x86 Atom_64 System ImageorGoogle APIs Intel x86 Atom System Image -
Apple Silicon Mac:
Google APIs ARM 64 v8a System Image
-
In the SDK Tools tab:
- Check Show Package Details (bottom-right corner).
- Expand Android SDK Build-Tools and check 36.0.0.
- Also make sure Android SDK Command-line Tools (latest) is checked.
Click Apply / OK to install everything.
Set up environment variables:
Open ~/.zprofile (or ~/.zshrc):
open -e ~/.zprofile
Add these lines at the bottom:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
Save, close, and reload:
source ~/.zprofile
Create an Android Emulator:
- Open Android Studio.
- Click More Actions → Virtual Device Manager (or Tools → Device Manager).
- Click Create Device.
- Pick a phone (e.g., Pixel 8) → Next.
- Select the VanillaIceCream API Level 35 system image → Next → Finish.
Part 2 — Windows Setup
Reminder: Windows can only build the Android version. For iOS, you need a Mac.
Step 1: Install Chocolatey
Open PowerShell as Administrator (right-click the Start button → "Terminal (Admin)" or "PowerShell (Admin)").
Paste this and press Enter:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Close and reopen PowerShell as Administrator.
Verify:
choco --version
Step 2: Install Node.js, JDK 17, and Git
choco install -y nodejs-lts microsoft-openjdk17 git
Close and reopen PowerShell. Verify all three:
node --version
java -version
git --version
Node should be v22.x.x or higher. Java should be openjdk version "17.x.x".
Step 3: Install Android Studio
- Download from developer.android.com/studio.
- Run the installer, choose Standard setup.
- Make sure these are checked during setup:
- Android SDK
- Android SDK Platform
- Android Virtual Device
- Performance (Intel HAXM) — if you're not using Hyper-V
Install the required SDK components:
Open Android Studio → Settings → Languages & Frameworks → Android SDK.
-
In the SDK Platforms tab:
- Check Show Package Details (bottom-right corner).
- Expand Android 15 (VanillaIceCream) and check:
Android SDK Platform 35Google APIs Intel x86 Atom_64 System Image
-
In the SDK Tools tab:
- Check Show Package Details (bottom-right corner).
- Expand Android SDK Build-Tools and check 36.0.0.
- Also make sure Android SDK Command-line Tools (latest) is checked.
Click Apply / OK to install everything.
Set environment variables:
- Open Start → search "Environment Variables" → click "Edit the system environment variables".
- Click the Environment Variables button.
- Under User variables, click New:
- Variable name:
ANDROID_HOME - Variable value:
%LOCALAPPDATA%\Android\Sdk
- Variable name:
- Select Path in User variables → Edit → New → add:
%LOCALAPPDATA%\Android\Sdk\platform-tools
- Click OK on all dialogs.
Create an Android Emulator:
- Open Android Studio.
- Click More Actions → Virtual Device Manager (or Tools → Device Manager).
- Click Create Device.
- Pick a phone (e.g., Pixel 8) → Next.
- Select the VanillaIceCream API Level 35 system image → Next → Finish.
Part 3 — Get the Code
You have two options: clone an existing project from a repo, or create a brand new app from scratch. Pick the one that applies to you.
Option A: Clone an Existing Project
This is for you if your team already has a React Native app in a Git repository.
Step 1: Clone the repo
git clone <your-repo-url>
cd <project-folder>
Replace <your-repo-url> with your actual repository URL (e.g., https://github.com/your-org/your-app.git).
Step 2: Set up environment variables
Many projects use a .env file. Check if there's a .env.example in the project root:
Mac / Linux:
cp .env.example .env
Windows (PowerShell):
Copy-Item .env.example .env
Open .env in any text editor and fill in the values. Ask your team for the correct values if you're unsure.
If there's no
.env.example, your project may not need one — check with your team.
Step 3: Install dependencies
Check which package manager your project uses by looking at the lock file in the project root:
| Lock File | Package Manager | Install Command |
|---|---|---|
package-lock.json |
npm | npm install |
yarn.lock |
Yarn | yarn install |
pnpm-lock.yaml |
pnpm | pnpm install |
If you need Yarn:
npm install -g yarn
If you need pnpm:npm install -g pnpm
Step 4: Install iOS dependencies (Mac only)
React Native iOS projects use CocoaPods to manage native libraries.
If your project has a Gemfile (most do):
bundle install
cd ios && bundle exec pod install && cd ..
If your project does NOT have a Gemfile:
sudo gem install cocoapods
cd ios && pod install && cd ..
For more details, see the CocoaPods Getting Started guide.
Now skip ahead to Part 4 — Run the App.
Option B: Create a Brand New App
This is for you if you're starting from zero — no existing project.
You have two paths: Expo (recommended by the official React Native docs) or bare React Native (no framework). Here's a quick comparison:
| Expo | Bare React Native | |
|---|---|---|
| Best for | Most apps, faster setup | Full native control from day one |
| Setup | One command | One command + CocoaPods |
| Native code access | Yes (via config plugins or ejecting) | Yes (direct) |
| OTA updates | Built-in (EAS Update) | Manual |
| Recommended by | Official React Native docs | — |
Path 1: Create with Expo (Recommended)
npx create-expo-app@latest MyApp
cd MyApp
That's it. Expo handles the native setup for you.
To run it:
npx expo start
Then press i for iOS Simulator or a for Android Emulator.
Learn more: Expo docs
Path 2: Create with bare React Native (No Framework)
First, make sure you don't have the old global CLI installed:
npm uninstall -g react-native-cli @react-native-community/cli
Then create the project:
npx @react-native-community/cli@latest init MyApp
cd MyApp
Install iOS dependencies (Mac only):
cd ios && pod install && cd ..
Now continue to Part 4 — Run the App.
Part 4 — Run the App
Note: If you used Expo (Option B, Path 1), follow the Expo commands above instead — you don't need Metro separately.
Step 1: Start Metro (the JS Bundler)
Metro is the JavaScript build tool for React Native — think of it like Vite or Webpack for mobile.
npm start
Or with Yarn:
yarn start
Keep this terminal open. Metro needs to stay running while you use the app.
If you run into cache issues, use:
npm start -- --reset-cache
Step 2: Run the App
Open a second terminal in the project folder.
For iOS (Mac only):
npm run ios
This opens the iOS Simulator and builds the app. The first build takes several minutes — this is normal.
For Android:
Make sure your Android Emulator is running first (open it from Android Studio → Device Manager), then:
npm run android
You can also build and run directly from Xcode (iOS) or Android Studio (Android) if you prefer.
Step 3: You're Running!
If everything worked, you should see your app on the simulator/emulator. Here's what to know:
- Fast Refresh is on by default — when you edit and save a file, the app updates instantly without a full rebuild.
-
Full Reload — if you need to reset the app state:
-
iOS: Press
Rin the Simulator. -
Android: Press
Rtwice, orCmd + M(Mac) /Ctrl + M(Windows) to open the Dev Menu → Reload.
-
iOS: Press
- Dev Menu — shake the device (or use the keyboard shortcut above) to access debugging tools, element inspector, and more.
Part 5 — Run on a Physical Device (Optional)
Simulators are great for development, but you might want to test on a real phone.
iOS (Physical iPhone/iPad)
- Connect your iPhone to your Mac with a USB cable.
- Open the
.xcworkspacefile in theios/folder with Xcode. - Select your connected device from the device dropdown (top bar).
- Go to Signing & Capabilities → select your Team (a free Apple ID Personal Team works).
- Click the Play button in Xcode to build and run.
First time? Your iPhone will ask you to trust the developer certificate. Go to Settings → General → VPN & Device Management on your phone and trust it.
Android (Physical Phone)
- On your phone, go to Settings → About Phone → tap Build Number 7 times to enable Developer Mode.
- Go to Settings → Developer Options → enable USB Debugging.
- Connect your phone to your computer with a USB cable.
- Approve the "Allow USB Debugging?" prompt on your phone.
- Verify the connection:
adb devices
You should see your device listed.
- Run the app:
npm run android
It will install directly on your phone instead of the emulator.
Troubleshooting
"Command not found" (node, java, brew, etc.)
Close your terminal completely and open a new one. Shell config changes (~/.zprofile, ~/.zshrc) only take effect in new sessions.
Mac Apple Silicon specific: If brew is not found after installing Homebrew, you missed the PATH setup step. Run:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
source ~/.zprofile
iOS build fails with "CocoaPods not found"
Make sure you ran bundle install first. If it still fails:
sudo gem install cocoapods
cd ios && pod install && cd ..
iOS build fails with signing errors
- Open the
.xcworkspacefile inside theios/folder using Xcode. - Select your project in the left sidebar.
- Go to Signing & Capabilities.
- Select your Team (create a free Personal Team with your Apple ID if you don't have one).
- Try building again.
iOS build fails when using nvm
If you use nvm to manage Node versions, Xcode can't find Node during builds. Fix it:
- Create or edit the file
ios/.xcode.env.localin your project:
export NODE_BINARY=$(which node)
- Add the following to
~/.zshenv(not~/.zshrc):
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
- In Xcode, make sure all Shell Script Build Phases use
/bin/zshas the shell.
Android build fails with "SDK location not found"
Create a file at android/local.properties with this content:
Mac:
sdk.dir=/Users/<YourUsername>/Library/Android/sdk
Windows:
sdk.dir=C:\\Users\\<YourUsername>\\AppData\\Local\\Android\\Sdk
Android Emulator won't start
- Windows: Make sure Virtualization (VT-x / AMD-V) is enabled in your BIOS/UEFI settings.
- Mac: Make sure you selected the right system image for your chip (ARM for Apple Silicon, x86 for Intel).
Metro shows "port 8081 already in use"
Something else is using port 8081. Kill it:
Mac:
lsof -i :8081 | grep LISTEN | awk '{print $2}' | xargs kill -9
Windows:
netstat -ano | findstr :8081
taskkill /PID <PID_NUMBER> /F
Build fails after pulling new code
When teammates add new dependencies or change native code, you need to reinstall:
npm install
For iOS, also re-run:
cd ios && bundle exec pod install && cd ..
Then restart Metro with a clean cache:
npm start -- --reset-cache
Nuclear option — clean everything and start fresh
When nothing else works:
Mac:
# Remove all generated files
rm -rf node_modules ios/Pods ios/build android/app/build
# Reinstall everything
npm install
cd ios && bundle exec pod install && cd ..
# Start fresh
npm start -- --reset-cache
Windows:
# Remove generated files
Remove-Item -Recurse -Force node_modules, android\app\build
# Reinstall
npm install
# Start fresh
npm start -- --reset-cache
Quick Reference
| Command | What It Does |
|---|---|
npm install |
Install JS dependencies |
npm start |
Start Metro bundler |
npm start -- --reset-cache |
Start Metro with cache cleared |
npm run ios |
Build & run on iOS Simulator |
npm run android |
Build & run on Android Emulator |
cd ios && bundle exec pod install |
Install iOS native dependencies |
adb devices |
List connected Android devices |
That's it. Your React Native app should be running on your simulator, emulator, or physical device. If you're still stuck, check the official React Native environment setup docs or ask your team.
Happy building!
Top comments (0)