react-native-setup
When to use
- Initial React Native 0.76+ / Expo SDK 52+ environment setup
- Installing or configuring Xcode, Android Studio, or their command-line tools
- Setting up iOS simulators or Android emulators for development
- Troubleshooting "Command not found",
ANDROID_HOME, or SDK path errors
- Fixing CocoaPods install failures (Apple Silicon, FFI, Ruby mismatches)
- Clearing Metro / Watchman cache or diagnosing reload loops
- Configuring EAS Build, dev clients, or OTA updates
- Migrating to or troubleshooting the New Architecture (Fabric / Turbo Modules)
Cross-links: mobile-e2e-strategy (Detox / Appium / Maestro selection),
docs/guidelines/agent-infra/ios-simulator-guide.md (iOS simulator decision matrix).
Assess current setup before changing anything
Before installing or upgrading anything, inspect what's already there — modifying a working toolchain blindly is the most common source of wasted hours.
- Read
package.json — RN version, Expo SDK, scripts, native dependencies.
- Check
ios/Podfile and ios/Podfile.lock — CocoaPods version, deployment target, RCT_NEW_ARCH_ENABLED flag.
- Check
android/build.gradle and android/gradle.properties — Gradle version, compile/target SDK, newArchEnabled, NDK version.
- Verify host tools —
node --version, xcodebuild -version, sdkmanager --list_installed, pod --version, watchman --version.
- Check for an existing
.nvmrc, .tool-versions, or Brewfile — honour the project's pinned versions over global ones.
- Read project README and CONTRIBUTING — many RN repos document one-time setup quirks (Apple Silicon Rosetta, Hermes flags, EAS profile names).
Procedure
- Identify the target stack — RN CLI vs Expo, target SDK, supported OS, monorepo or single-package.
- Verify prerequisites — Node, package manager, Watchman, platform SDKs (see matrix below).
- Configure platform tooling — Xcode + CocoaPods (iOS) or Android Studio + SDK 34/35 (Android).
- Install project dependencies —
npm/yarn/pnpm/bun install, then pod install for iOS.
- Run a smoke build —
npm run ios / npm run android / npx expo start.
- Validate — app launches, fast refresh works, Metro bundler runs without warnings.
- On failure — apply the matching pattern from "Common setup issues" below.
Prerequisites (2025 baseline)
Node.js
- Node 20.x minimum (Node 18 EOL April 2025); Node 22 LTS recommended.
node --version && npm --version.
- npm, yarn, pnpm, bun all supported. Corepack for yarn:
corepack enable && corepack prepare yarn@stable --activate.
Xcode (macOS, iOS)
- Xcode 16.1+ minimum (RN 0.83), Xcode 26+ for Liquid Glass.
xcode-select --install then sudo xcodebuild -license accept.
- iOS 15.1+ deployment target; iOS 18+/26 for latest features.
Android Studio
- Ladybug or later (2024.2.1+).
- SDK Platform 35 (API 35), Build-Tools 35.0.0, Platform-Tools, Emulator.
- NDK 27.1.12297006 + CMake 3.22.1+ for native modules / Turbo Modules.
compileSdkVersion 35, targetSdkVersion 35, minSdkVersion 24.
ANDROID_HOME exported; edge-to-edge display ready (Android 15+).
Watchman
- macOS:
brew install watchman.
- Required for fast refresh on large codebases. Reset:
watchman watch-del-all.
Platform setup
iOS
- CocoaPods 1.15+:
sudo gem install cocoapods.
- New Architecture pods:
RCT_NEW_ARCH_ENABLED=1 pod install.
- Provisioning profiles, certificates managed in Xcode or via EAS.
- Simulator management:
xcrun simctl list devices. Liquid Glass requires iOS 26 simulator.
Android
- Gradle 8.10+ (bundled with Ladybug).
- AVD with API 35 image; verify edge-to-edge layout.
- New Architecture:
newArchEnabled=true in gradle.properties.
Metro bundler
- Default port 8081. Cache reset:
npx react-native start --reset-cache.
- Symlink support and custom resolvers needed for monorepos.
EAS Build (Expo)
npm install -g eas-cli then eas login.
eas build:configure to seed eas.json.
- Dev clients for custom native modules; EAS Update for OTA.
Common setup issues
"Command not found"
- PATH for Node, Android SDK, Xcode tools missing in
~/.zshrc or ~/.bash_profile.
- Symlink drift with nvm / fnm — re-run
nvm use after shell reload.
SDK not found
echo $ANDROID_HOME empty → re-export.
- Re-run SDK Manager; reinstall NDK if native modules fail.
Pod install failures
- CocoaPods < 1.15 incompatible with New Architecture — upgrade.
- Apple Silicon FFI compile errors → use system Ruby or rbenv-managed Ruby.
- Stuck pods:
pod deintegrate && pod install.
Build failures
- Clean iOS:
rm -rf ios/build ios/Pods ios/Podfile.lock then pod install --project-directory=ios.
- Clean Android:
./gradlew -p android clean.
- Clear Xcode derived data when stale build artefacts persist.
New Architecture issues
- Turbo Module not found → confirm codegen ran during build.
- Fabric component not rendering → verify native registration.
- Bridge incompatibility → use the interop layer.
Quick verification
node --version # 20+ (22 LTS preferred)
npm --version
xcodebuild -version # 16.1+
pod --version # 1.15+
adb --version
emulator -version
watchman version
eas --version # Expo only
echo $ANDROID_HOME # non-empty
Quick commands
Create / run RN CLI project
npx @react-native-community/cli init MyProject
cd MyProject
RCT_NEW_ARCH_ENABLED=1 pod install --project-directory=ios
npm start # Metro
npm run ios # in a second terminal
npm run android # in a third terminal
Create / run Expo project
npx create-expo-app@latest MyProject
cd MyProject
npx expo start
# Custom native code → dev client:
npx expo install expo-dev-client
eas build --profile development --platform ios
eas build --profile development --platform android
Simulator / emulator
xcrun simctl list devices
xcrun simctl boot "iPhone 16 Pro"
emulator -list-avds
emulator -avd Pixel_8_API_35
Reset everything
watchman watch-del-all
npx react-native start --reset-cache # RN CLI
npx expo start --clear # Expo
Pro tips
- Shell profile — add SDK paths once, reload once:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
- EAS minimum
eas.json — development (dev client + internal), preview (internal), production (defaults).
- Hermes — RN ≥ 0.70 ships Hermes by default; verify with
global.HermesInternal !== undefined at runtime.
- Health check — a single shell function running the verification block above catches 80 % of "it doesn't build" reports.
Version compatibility (2025)
| Component |
Minimum |
Recommended |
Notes |
| Node.js |
20.x |
22 LTS |
Node 18 EOL April 2025 |
| React Native |
0.76 |
0.83 |
New Architecture default since 0.76 |
| React |
18.3 |
19.2 |
Activity, useEffectEvent |
| Expo SDK |
52 |
54 |
Native tabs, Liquid Glass |
| Xcode |
16.1 |
26 |
iOS 26 required for Liquid Glass |
| Android SDK |
34 |
35 |
Edge-to-edge support |
| CocoaPods |
1.14 |
1.15+ |
New Architecture compatibility |
| Gradle |
8.6 |
8.10+ |
K2 compiler support |
Output format
- A short setup plan keyed off the target stack (RN CLI vs Expo, iOS vs Android vs both).
- Concrete shell commands the user can paste — no placeholders unless flagged
<…>.
- A verification block confirming the toolchain is healthy before any feature work.
Auto-trigger keywords
- React Native, Expo, EAS Build
- Xcode, CocoaPods, pod install
- Android Studio, ANDROID_HOME, AVD, emulator
- Metro bundler, Watchman, fast refresh
- New Architecture, Fabric, Turbo Modules
Gotcha
- Don't set
RCT_NEW_ARCH_ENABLED=1 selectively — once enabled, every pod install for that project must use it or cached artefacts diverge.
- Apple Silicon + system Ruby + FFI is the single biggest source of "pod install hangs" reports — switch to rbenv before retrying.
- Watchman left over from a previous project can pin Metro to a stale tree —
watchman watch-del-all is cheap, run it before deeper debugging.
- iOS Simulator versions are tied to Xcode versions. Liquid Glass features need both Xcode 26 AND an iOS 26 simulator image installed.
- Android NDK version drift breaks Turbo Modules silently — pin
27.1.12297006 until the project explicitly upgrades.
Do NOT
- Do NOT mix
npm, yarn, pnpm, and bun lockfiles in the same project — pick one, commit its lockfile, delete the others.
- Do NOT skip
pod install after pulling iOS-side changes — the JS bundle will load but native modules will be stale.
- Do NOT enable New Architecture mid-feature — flag it on a clean branch, run a full clean build, validate both platforms.
- Do NOT hand-edit
Podfile.lock or gradle.lock-style files — re-run the installers instead.
- Do NOT commit
node_modules, ios/Pods, android/.gradle, or platform build/ directories.
1---2name: react-native-setup3description: Use when setting up React Native or Expo dev environments — Xcode, Android Studio, CocoaPods, EAS, Metro, New Architecture — even when the user just says 'my RN build won't start'.4---56# react-native-setup78## When to use910- Initial React Native 0.76+ / Expo SDK 52+ environment setup11- Installing or configuring Xcode, Android Studio, or their command-line tools12- Setting up iOS simulators or Android emulators for development13- Troubleshooting "Command not found", `ANDROID_HOME`, or SDK path errors14- Fixing CocoaPods install failures (Apple Silicon, FFI, Ruby mismatches)15- Clearing Metro / Watchman cache or diagnosing reload loops16- Configuring EAS Build, dev clients, or OTA updates17- Migrating to or troubleshooting the New Architecture (Fabric / Turbo Modules)1819**Cross-links:** `mobile-e2e-strategy` (Detox / Appium / Maestro selection),20`docs/guidelines/agent-infra/ios-simulator-guide.md` (iOS simulator decision matrix).2122## Assess current setup before changing anything2324Before installing or upgrading anything, inspect what's already there — modifying a working toolchain blindly is the most common source of wasted hours.25261. **Read `package.json`** — RN version, Expo SDK, scripts, native dependencies.272. **Check `ios/Podfile` and `ios/Podfile.lock`** — CocoaPods version, deployment target, RCT_NEW_ARCH_ENABLED flag.283. **Check `android/build.gradle` and `android/gradle.properties`** — Gradle version, compile/target SDK, `newArchEnabled`, NDK version.294. **Verify host tools** — `node --version`, `xcodebuild -version`, `sdkmanager --list_installed`, `pod --version`, `watchman --version`.305. **Check for an existing `.nvmrc`, `.tool-versions`, or `Brewfile`** — honour the project's pinned versions over global ones.316. **Read project README and CONTRIBUTING** — many RN repos document one-time setup quirks (Apple Silicon Rosetta, Hermes flags, EAS profile names).3233## Procedure34351. **Identify the target stack** — RN CLI vs Expo, target SDK, supported OS, monorepo or single-package.362. **Verify prerequisites** — Node, package manager, Watchman, platform SDKs (see matrix below).373. **Configure platform tooling** — Xcode + CocoaPods (iOS) or Android Studio + SDK 34/35 (Android).384. **Install project dependencies** — `npm`/`yarn`/`pnpm`/`bun install`, then `pod install` for iOS.395. **Run a smoke build** — `npm run ios` / `npm run android` / `npx expo start`.406. **Validate** — app launches, fast refresh works, Metro bundler runs without warnings.417. **On failure** — apply the matching pattern from "Common setup issues" below.4243## Prerequisites (2025 baseline)4445**Node.js**46- Node 20.x minimum (Node 18 EOL April 2025); Node 22 LTS recommended.47- `node --version && npm --version`.48- npm, yarn, pnpm, bun all supported. Corepack for yarn:49 `corepack enable && corepack prepare yarn@stable --activate`.5051**Xcode (macOS, iOS)**52- Xcode 16.1+ minimum (RN 0.83), Xcode 26+ for Liquid Glass.53- `xcode-select --install` then `sudo xcodebuild -license accept`.54- iOS 15.1+ deployment target; iOS 18+/26 for latest features.5556**Android Studio**57- Ladybug or later (2024.2.1+).58- SDK Platform 35 (API 35), Build-Tools 35.0.0, Platform-Tools, Emulator.59- NDK 27.1.12297006 + CMake 3.22.1+ for native modules / Turbo Modules.60- `compileSdkVersion 35`, `targetSdkVersion 35`, `minSdkVersion 24`.61- `ANDROID_HOME` exported; edge-to-edge display ready (Android 15+).6263**Watchman**64- macOS: `brew install watchman`.65- Required for fast refresh on large codebases. Reset: `watchman watch-del-all`.6667## Platform setup6869**iOS**70- CocoaPods 1.15+: `sudo gem install cocoapods`.71- New Architecture pods: `RCT_NEW_ARCH_ENABLED=1 pod install`.72- Provisioning profiles, certificates managed in Xcode or via EAS.73- Simulator management: `xcrun simctl list devices`. Liquid Glass requires iOS 26 simulator.7475**Android**76- Gradle 8.10+ (bundled with Ladybug).77- AVD with API 35 image; verify edge-to-edge layout.78- New Architecture: `newArchEnabled=true` in `gradle.properties`.7980**Metro bundler**81- Default port 8081. Cache reset: `npx react-native start --reset-cache`.82- Symlink support and custom resolvers needed for monorepos.8384**EAS Build (Expo)**85- `npm install -g eas-cli` then `eas login`.86- `eas build:configure` to seed `eas.json`.87- Dev clients for custom native modules; EAS Update for OTA.8889## Common setup issues9091**"Command not found"**92- PATH for Node, Android SDK, Xcode tools missing in `~/.zshrc` or `~/.bash_profile`.93- Symlink drift with nvm / fnm — re-run `nvm use` after shell reload.9495**SDK not found**96- `echo $ANDROID_HOME` empty → re-export.97- Re-run SDK Manager; reinstall NDK if native modules fail.9899**Pod install failures**100- CocoaPods < 1.15 incompatible with New Architecture — upgrade.101- Apple Silicon FFI compile errors → use system Ruby or rbenv-managed Ruby.102- Stuck pods: `pod deintegrate && pod install`.103104**Build failures**105- Clean iOS: `rm -rf ios/build ios/Pods ios/Podfile.lock` then `pod install --project-directory=ios`.106- Clean Android: `./gradlew -p android clean`.107- Clear Xcode derived data when stale build artefacts persist.108109**New Architecture issues**110- Turbo Module not found → confirm codegen ran during build.111- Fabric component not rendering → verify native registration.112- Bridge incompatibility → use the interop layer.113114## Quick verification115116```bash117node --version # 20+ (22 LTS preferred)118npm --version119xcodebuild -version # 16.1+120pod --version # 1.15+121adb --version122emulator -version123watchman version124eas --version # Expo only125echo $ANDROID_HOME # non-empty126```127128## Quick commands129130**Create / run RN CLI project**131```bash132npx @react-native-community/cli init MyProject133cd MyProject134RCT_NEW_ARCH_ENABLED=1 pod install --project-directory=ios135npm start # Metro136npm run ios # in a second terminal137npm run android # in a third terminal138```139140**Create / run Expo project**141```bash142npx create-expo-app@latest MyProject143cd MyProject144npx expo start145# Custom native code → dev client:146npx expo install expo-dev-client147eas build --profile development --platform ios148eas build --profile development --platform android149```150151**Simulator / emulator**152```bash153xcrun simctl list devices154xcrun simctl boot "iPhone 16 Pro"155emulator -list-avds156emulator -avd Pixel_8_API_35157```158159**Reset everything**160```bash161watchman watch-del-all162npx react-native start --reset-cache # RN CLI163npx expo start --clear # Expo164```165166## Pro tips1671681. **Shell profile** — add SDK paths once, reload once:169 ```bash170 export ANDROID_HOME=$HOME/Library/Android/sdk171 export PATH=$PATH:$ANDROID_HOME/emulator172 export PATH=$PATH:$ANDROID_HOME/platform-tools173 export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin174 ```1752. **EAS minimum `eas.json`** — `development` (dev client + internal), `preview` (internal), `production` (defaults).1763. **Hermes** — RN ≥ 0.70 ships Hermes by default; verify with `global.HermesInternal !== undefined` at runtime.1774. **Health check** — a single shell function running the verification block above catches 80 % of "it doesn't build" reports.178179## Version compatibility (2025)180181| Component | Minimum | Recommended | Notes |182|---|---|---|---|183| Node.js | 20.x | 22 LTS | Node 18 EOL April 2025 |184| React Native | 0.76 | 0.83 | New Architecture default since 0.76 |185| React | 18.3 | 19.2 | `Activity`, `useEffectEvent` |186| Expo SDK | 52 | 54 | Native tabs, Liquid Glass |187| Xcode | 16.1 | 26 | iOS 26 required for Liquid Glass |188| Android SDK | 34 | 35 | Edge-to-edge support |189| CocoaPods | 1.14 | 1.15+ | New Architecture compatibility |190| Gradle | 8.6 | 8.10+ | K2 compiler support |191192## Output format1931941. A short setup plan keyed off the target stack (RN CLI vs Expo, iOS vs Android vs both).1952. Concrete shell commands the user can paste — no placeholders unless flagged `<…>`.1963. A verification block confirming the toolchain is healthy before any feature work.197198## Auto-trigger keywords199200- React Native, Expo, EAS Build201- Xcode, CocoaPods, pod install202- Android Studio, ANDROID_HOME, AVD, emulator203- Metro bundler, Watchman, fast refresh204- New Architecture, Fabric, Turbo Modules205206## Gotcha207208- Don't set `RCT_NEW_ARCH_ENABLED=1` selectively — once enabled, every `pod install` for that project must use it or cached artefacts diverge.209- Apple Silicon + system Ruby + FFI is the single biggest source of "pod install hangs" reports — switch to rbenv before retrying.210- Watchman left over from a previous project can pin Metro to a stale tree — `watchman watch-del-all` is cheap, run it before deeper debugging.211- iOS Simulator versions are tied to Xcode versions. Liquid Glass features need both Xcode 26 AND an iOS 26 simulator image installed.212- Android NDK version drift breaks Turbo Modules silently — pin `27.1.12297006` until the project explicitly upgrades.213214## Do NOT215216- Do NOT mix `npm`, `yarn`, `pnpm`, and `bun` lockfiles in the same project — pick one, commit its lockfile, delete the others.217- Do NOT skip `pod install` after pulling iOS-side changes — the JS bundle will load but native modules will be stale.218- Do NOT enable New Architecture mid-feature — flag it on a clean branch, run a full clean build, validate both platforms.219- Do NOT hand-edit `Podfile.lock` or `gradle.lock`-style files — re-run the installers instead.220- Do NOT commit `node_modules`, `ios/Pods`, `android/.gradle`, or platform `build/` directories.