Skip to content

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

@william-stacken

Description

@william-stacken

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

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions