This guide walks you through setting up your development environment for React Native. You’ll install the necessary tools to build and run apps on both iOS and Android.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/react-native/llms.txt
Use this file to discover all available pages before exploring further.
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
Install Node.js
Download from nodejs.org or use a version manager like nvm:
iOS development setup (macOS only)
Install Xcode
Install Command Line Tools
Open Xcode, go to Preferences → Locations, and select the Command Line Tools versionOr via terminal:
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
Download Android Studio
Download from developer.android.com
Run the installer
During installation, ensure these components are selected:
- Android SDK
- Android SDK Platform
- Android Virtual Device
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)
Open Device Manager
In Android Studio, click Tools → Device Manager (or the device icon in the toolbar)
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
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