Skip to content

run-ios command fails on rn-tester: Cannot find Gemfile #2754

@cgoldsby

Description

@cgoldsby

Description

The npx react-native run-ios command fails when running against the rn-tester app because it cannot locate the Gemfile. In rn-tester, the Gemfile is in the same directory as the Podfile, but the CLI assumes the standard project structure where the Gemfile is one level above the ios folder.

Steps to Reproduce

  1. gh repo clone facebook/react-native
  2. Run yarn to install dependencies
  3. cd packages/rn-tester
  4. Run yarn clean-ios
  5. Run yarn prepare-ios
  6. Run npx react-native run-ios --scheme RNTester --simulator "iPhone 16"

Expected Behavior

The command should successfully locate the Gemfile and install CocoaPods dependencies.

Actual Behavior

The command fails with:

✖ Installing CocoaPods...

Environment

React Native: (main branch)
OS: macOS
Node: (your version)

Root Cause

Modern React Native apps follow this structure:

ios/Podfile
Gemfile

However, rn-tester has:

packages/rn-tester/Podfile
packages/rn-tester/Gemfile

The CLI's Gemfile lookup logic doesn't account for projects where the Gemfile is colocated with the Podfile.

Workaround

Changing the Gemfile check in node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js works locally:

- if (_fs().default.existsSync('../Gemfile') && !(options === null || options === void 0 ? void 0 : options.skipBundleInstall)) {
+ if (_fs().default.existsSync('./Gemfile') && !(options === null || options === void 0 ? void 0 : options.skipBundleInstall)) {

Proposed Solution

Add an environment variable (e.g., RCT_GEMFILE_PATH) to allow overriding the Gemfile path. This would enable non-standard project structures like rn-tester to specify their Gemfile location without requiring changes to the project layout.

Alternatively, the CLI could check for a Gemfile in the same directory as the Podfile before falling back to the parent directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions