Skip to content
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

Fix Ruby Gem Permission in Setup Script #2005

Closed
wants to merge 1 commit into from

Conversation

skywinder
Copy link
Collaborator

@skywinder skywinder commented Mar 13, 2025

The setup script is failing during bundle install with permission errors when trying to install the JSON gem. This appears to be related to PR #1998 (commit 095f4ae), which introduced changes that led to permission issues during the gem installation process.

Testing Required:

  • Test on macOS with a clean environment
  • Verify bundle install succeeds without permission errors
  • Confirm setup completes successfully for both iOS and Android targets
  • Test with different user permission configurations

@skywinder skywinder requested a review from beastoin March 13, 2025 17:18
@beastoin
Copy link
Collaborator

1/ man, tell me more details.

for example, brew is more straitghtforward for me. if you are facing an issue, tell me your findings - what is the cause and why your fixes could help another developers without introducing new issues.

@skywinder

@skywinder
Copy link
Collaborator Author

skywinder commented Mar 14, 2025

Homebrew doesn’t properly manage versioning, which can potentially lead to inconsistencies. However, I’m fine with either approach for now.

Regarding the issue, let’s move the discussion to Discord or Telegram so we can try to fix it together—I currently have no clue how to resolve it.

First, I installed the missing dependency (see screenshot below):
CleanShot 2025-03-14 at 14 38 15@2x

bash setup.sh ios

got this error

❯ bash setup.sh ios


/opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1421:in 'block in Gem::Specification#activate_dependencies': Could not find 'nkf' (>= 0) among 146 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/pk/.local/share/fastlane/3.4.0:/opt/homebrew/Cellar/fastlane/2.227.0/libexec' at: /opt/homebrew/Cellar/fastlane/2.227.0/libexec/specifications/CFPropertyList-3.0.7.gemspec, execute `gem env` for more information
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1425:in 'block in Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path'
	from /opt/homebrew/Cellar/fastlane/2.227.0/libexec/bin/fastlane:25:in '<main>'
/opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/dependency.rb:303:in 'Gem::Dependency#to_specs': Could not find 'nkf' (>= 0) - did find: [nkf-0.2.0] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=/Users/pk/.local/share/fastlane/3.4.0:/opt/homebrew/Cellar/fastlane/2.227.0/libexec' , execute `gem env` for more information
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1419:in 'block in Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1425:in 'block in Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize'
	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path'
	from /opt/homebrew/Cellar/fastlane/2.227.0/libexec/bin/fastlane:25:in '<main>'

@beastoin
Copy link
Collaborator

beastoin commented Mar 15, 2025

1/ man, could you try with $brew uninstall fastlane && brew cleanup fastlane && brew install fastlane ?

@skywinder ^

@skywinder
Copy link
Collaborator Author

1/ man, could you try with $brew uninstall fastlane && brew cleanup fastlane && brew install fastlane ?

@beastoin Sure, that doesn't help.

The issue is related to Ruby version conflicts. I have Ruby 3.4.2 installed via Homebrew, but CocoaPods is using Ruby 3.2.2 managed by rbenv.

What are you using for your Ruby environment? rbenv, RVM, Homebrew Ruby, or macOS system Ruby? Depending on this, there are several different options available. I'm ready to set up your option, but I personally prefer using rbenv for the basics to avoid conflicts with other projects.

Can you please run the following commands and share your parameters?

which ruby  
ruby -v  
rbenv versions  
brew list | grep ruby  

Here are my results:

/opt/homebrew/opt/ruby/bin/ruby  
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin23]  
  system  
  3.1.6  
* 3.2.2 (set by ~/.rbenv/version)  
ruby  
ruby-build  



@skywinder skywinder marked this pull request as draft March 16, 2025 23:05
@skywinder
Copy link
Collaborator Author

skywinder commented Mar 16, 2025

@beastoin

  1. How did you set up fastlane?

There are three options available:
🔗 Fastlane Setup Guide

The installation method affects how the rest of the scripts are run—whether via bundler, brew, or gem.

@beastoin
Copy link
Collaborator

  1. I use brew.

This guy #2039 set up successfully with brew. Please use brew and check it again.

/ closed

the script is not broken.

Feel free to reopen it if you trust this is the way to let people set up more easily.

@beastoin beastoin closed this Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants