Skip to content

run-ios wants my sudo password because it wont accept pod installed with bundler #2668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
buschco opened this issue Jun 3, 2025 · 2 comments

Comments

@buschco
Copy link

buschco commented Jun 3, 2025

Environment

info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (14) arm64 Apple M4 Pro
  Memory: 1.52 GB / 48.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: ~/.nvm/versions/node/v18.20.5/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.20.5/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v18.20.5/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12550806
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.3
    path: /Users/colin/.sdkman/candidates/java/current/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/colin/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Description

I think the program fails to fast. instead it should try bundle exec pod --version first since on other places it will also respect the bundle installed version.

Reproducible Demo

  1. make sure no cocoapods is not installed globally: gem uninstall cocoapods
  2. npx @react-native-community/cli@latest init MyApp
  3. press n for cocoa pods question
  4. cd MyApp
  5. bundle install

Now bundle exec pod --version has an 0 exit code.

npx react-native run-ios --force-pods will either fail or globally install cocoapods again, but it does not need to since we can use bundle exec pod instead.

@buschco
Copy link
Author

buschco commented Jun 3, 2025

I submitted an PR (#2669) that should fix this issue by using the right pod command

@buschco
Copy link
Author

buschco commented Jun 3, 2025

If you only want to use the pod installed with bundler you can use this patch:

patches/@react-native-community+cli-config-apple+18.0.0.patch

diff --git a/node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js b/node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js
index fc52a47..217d71b 100644
--- a/node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js
+++ b/node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js
@@ -75,7 +75,7 @@ async function runPodInstall(loader, options) {
 async function runPodUpdate(loader) {
   try {
     loader.start(`Updating CocoaPods repositories ${_chalk().default.dim('(this may take a few minutes)')}`);
-    await (0, _execa().default)('pod', ['repo', 'update']);
+    await (0, _execa().default)('bundle', ['exec', 'pod', 'repo', 'update']);
   } catch (error) {
     // "pod" command outputs errors to stdout (at least some of them)
     _cliTools().logger.log(error.stderr || error.stdout);
@@ -125,7 +125,7 @@ async function installPods(loader, options) {
       // Check if "pod" is available and usable. It happens that there are
       // multiple versions of "pod" command and even though it's there, it exits
       // with a failure
-      await (0, _execa().default)('pod', ['--version']);
+      await (0, _execa().default)('bundle', ['exec', 'pod', '--version']);
     } catch (e) {
       loader.info();
       await installCocoaPods(loader);

@buschco buschco changed the title run-ios wants my sudo password because it wont accept pod installed with bunlder run-ios wants my sudo password because it wont accept pod installed with bundler Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant