Choose between Expo CLI (easier, managed workflow) or React Native CLI (full native control). This guide covers React Native CLI for maximum flexibility.
Prerequisites
- macOS
- Windows
- Linux
- Node.js 20.19.4+ or 22.13.0+ or 24.3.0+
- Watchman (recommended for file watching)
- Xcode (for iOS development)
- Android Studio (for Android development)
- JDK 17 (required for Android)
Installing Node.js
React Native requires a specific version of Node.js as defined inpackage.json:
package.json
1
Install Node.js
Download from nodejs.org or use a version manager like nvm:
2
Verify installation
iOS development setup (macOS only)
Install Xcode
1
Download Xcode
Install Xcode from the Mac App Store (version 14.0 or newer recommended)
2
Install Command Line Tools
Open Xcode, go to Preferences → Locations, and select the Command Line Tools versionOr via terminal:
3
Install iOS Simulator
In Xcode, go to Preferences → Components and install your desired iOS Simulator versions
Install CocoaPods
CocoaPods manages iOS dependencies. React Native uses it extensively:If you encounter permission issues, you may need to use a Ruby version manager like rbenv or install using
--user-install.Install Watchman (recommended)
Watchman watches files for changes and triggers actions. It improves performance significantly:Android development setup (all platforms)
Install Android Studio
1
Download Android Studio
Download from developer.android.com
2
Run the installer
During installation, ensure these components are selected:
- Android SDK
- Android SDK Platform
- Android Virtual Device
3
Install Android SDK
Open Android Studio, go to Settings → Appearance & Behavior → System Settings → Android SDKInstall the following:
- Android 14.0 (API 34) or latest
- Android SDK Platform 34
- Intel x86 Atom_64 System Image or Google APIs Intel x86 Atom System Image
Configure Android SDK environment variables
Add these to your shell profile (~/.zshrc, ~/.bash_profile, or ~/.bashrc):
Install Java Development Kit (JDK)
React Native requires JDK 17. Android Studio includes a JDK, but you may need to install it separately:- macOS
- Windows
- Linux
Create an Android Virtual Device (AVD)
1
Open Device Manager
In Android Studio, click Tools → Device Manager (or the device icon in the toolbar)
2
Create Virtual Device
Click Create Device, select a phone model (e.g., Pixel 6), and click Next
3
Download system image
Select a system image (API 34 recommended), download it, and click Next
4
Finish setup
Name your AVD and click Finish
Install React Native CLI
The React Native CLI is accessed vianpx or yarn:
Verify your setup
Create a test project to verify everything works:Test iOS (macOS only)
The first build may take 10-15 minutes as React Native compiles native dependencies.
Test Android
1
Start the emulator
Open Android Studio → Device Manager → Launch your AVDOr via command line:
2
Run the app
Troubleshooting
Build failures on iOS
Build failures on iOS
Clear derived data and CocoaPods cache:Clean Xcode build:
Product → Clean Build Folder (Shift + Cmd + K)
Android build failures
Android build failures
Clear Gradle cache:Check Android SDK:
Ensure
ANDROID_HOME is set correctly:Metro bundler issues
Metro bundler issues
Reset Metro cache:Check port 8081:
Ensure nothing else is using port 8081:
Node version mismatch
Node version mismatch
React Native requires specific Node versions. Use nvm to manage versions:
Optional tools
Flipper debugger
Flipper provides advanced debugging capabilities:- Network inspector
- Layout inspector
- Database viewer
- Crash reporter
Watchman (Linux)
On Linux, install Watchman from source:Next steps
Now that your environment is configured:- Follow the quickstart guide to build your first app
- Learn how to run on physical devices
- Explore core components and APIs