capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: Capacitor finds unrelated Gemfile in an SPM project

Open william-stacken opened this issue 6 months ago • 1 comments

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 7.4.3 @capacitor/core: 7.4.3 @capacitor/android: 7.4.3 @capacitor/ios: 7.4.3

Installed Dependencies:

@capacitor/cli: 7.4.3 @capacitor/core: 7.4.3 @capacitor/android: 7.4.3 @capacitor/ios: 7.4.3

[success] iOS looking great! 👌 [success] Android looking great! 👌

Other API Details

npm 10.9.2
node v22.15.1

Platforms Affected

  • [x] iOS
  • [ ] Android
  • [ ] Web

Current Behavior

I am running npx cap update in my iOS project that I have migrated to SPM. It results in the following:

[info] Using Gemfile: Bundler update needed...
[error] ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

It seems capacitor thinks I am still using cocoapods because it uses the exit code of bundle &> /dev/null ; echo $? to determine if it should update bundler.

https://github.com/ionic-team/capacitor/blob/7.4.3/cli/src/ios/common.ts#L21

I am running capacitor from a subdirectory of a directory that happens to contain a Gemfile, and bundler thus finds it. When capacitor tries to update bundler, it fails because it is my system bundler. But I don't suppose capacitor should update bundler in an SPM project, let alone touch unrelated Gemfiles?

Expected Behavior

Capacitor does not try to update bundler when I am using an SPM project, and also does not write to that unrelated Gemfile. Perhaps it can try to locate the Gemfile itself first, so that bundler won't find any unrelated Gemfiles?

Project Reproduction

https://github.com/william-stacken/capacitor-bug

Additional Information

No response

william-stacken avatar Aug 28 '25 16:08 william-stacken

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar Sep 04 '25 13:09 ionitron-bot[bot]