react-native-community / react-native-community/cli
run-ios --udid <physical device> throws "No simulator available" because the fallback simulator is resolved eagerly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 949
- PR merge metrics
- No merged PRs in 30d
Description
Environment
npx react-native info
System:
OS: macOS 26.5
CPU: (10) arm64 Apple M2 Pro
Memory: 86.63 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.10.0
path: ~/.nodenv/versions/24.10.0/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 11.6.1
path: ~/.nodenv/versions/24.10.0/bin/npm
Watchman:
version: 2026.07.27.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.5
- iOS 26.5
- macOS 26.5
- tvOS 26.5
- visionOS 26.5
- watchOS 26.5
Android SDK: Not Found
IDEs:
Android Studio: 2026.1 AI-261.26222.65.2613.16025427
Xcode:
version: 26.6/17F113
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.20
path: /usr/bin/javac
Ruby:
version: 3.2.2
path: ~/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.1.2
wanted: 20.1.2
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.85.3
wanted: 0.85.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Description
run-ios --udid <udid-of-a-physical-iPhone> fails before it looks at the device:
error No simulator available with udid "00008140-XXXXXXXXXXXXXXXX"
createRun.ts:212 resolves the fallback simulator before any branch decides whether a simulator is involved:
const fallbackSimulator =
platformName === 'ios' || platformName === 'tvos'
? getFallbackSimulator(args) // throws here
: devices[0]
It is read only at lines 271, 417 and 426, all simulator paths. Device runs never use it but still pay for it, and getFallbackSimulator throws instead of returning null.
It throws because findMatchingSimulator gets the original args: with args.udid set it returns only on an exact simulator udid match, which a physical device never satisfies. The hardcoded fallback list (iPhone 14/13/12/11) then finds nothing on Xcode 26, which ships the iPhone 17 family.
The same call breaks every run-ios invocation when no simulator runtime is installed, a valid device-only setup: the iPhoneOS SDK ships inside Xcode.app, the runtime is a separate ~8 GB download device builds never touch.
#2795 reworked this branch and kept the eager call.
Suggested fix
Resolve lazily, so only simulator paths can fail on a simulator:
const fallbackSimulator = () =>
platformName === 'ios' || platformName === 'tvos'
? getFallbackSimulator(args)
: devices[0]
and call fallbackSimulator() at the three call sites. Ran this as a local patch; device and simulator runs both behaved correctly.
Reproducible Demo
Xcode 26, simulators available but none named iPhone 14/13/12/11 and none ever booted (no lastBootedAt in xcrun simctl list --json devices), physical iPhone connected:
npx react-native run-ios --udid <udid-of-the-connected-iPhone>
# error No simulator available with udid "00008140-XXXXXXXXXXXXXXXX"
Only the --udid shape fails:
const {
getFallbackSimulator
} = require('@react-native-community/cli-platform-apple/build/commands/runCommand/getFallbackSimulator.js')
getFallbackSimulator({}) // OK: iPhone 17 Pro
getFallbackSimulator({ device: 'My iPhone' }) // OK: iPhone 17 Pro
getFallbackSimulator({ udid: '00008140-XXXXXXXXXXXXXXXX' }) // throws
The first two pass only incidentally: with no udid in args the matcher falls through to "first available simulator".
End to end, the real command dies before building:
info Found Xcode workspace "MyApp.xcworkspace"
error No simulator available with udid "00008140-XXXXXXXXXXXXXXXX".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in createRun.ts around line 212 and inspect the three fallbackSimulator call sites at lines 271, 417, and 426. Compare them with getFallbackSimulator and reproduce with run-ios --udid using a physical device. Done means physical-device runs no longer resolve a simulator, while simulator paths still resolve their fallback normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100