Kathiresan Murugan
Kathiresan Murugan

Reputation: 2962

Riod-iOS Error: You don't have write permissions "Gem::FilePermissionError"

I have downloaded a Riot-iOS and follow a build instructions.

When I run '$ bundle install'

Traceback (most recent call last): 2: from /usr/bin/bundle:23:in <main>' 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in activate_bin_path' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /Users/premkumar/Downloads/riot-ios-develop/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, runbundle update --bundler. To install the missing version, rungem install bundler:2.0.2`

After I run a '$ bundle exec pod install'

Traceback (most recent call last): 2: from /usr/bin/bundle:23:in <main>' 1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in activate_bin_path' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /Users/premkumar/Downloads/riot-ios-develop/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, runbundle update --bundler. To install the missing version, rungem install bundler:2.0.2`

So, I update a gem by running '$gem update --system'

Updating rubygems-update ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

enter image description here

Kindly help me.

Upvotes: 5

Views: 21175

Answers (2)

stevec
stevec

Reputation: 52328

Just wanted to stress a point that @ZachTuttle makes: you're using the system installation of ruby (!!) (the one that comes preinstalled with macOS) - 99.9% of the time you don't want to do that!

You can tell this is happening because throughout the error messages are references to the location of the macOS system installation:

/System/Library/Frameworks/Ruby.framework/Versions ...

To fix, you almost certainly want to get the output of ruby -v to be one that you installed yourself. There are a number of recommended ways to install ruby.

If you have already installed ruby yourself (i.e. a non-system version), you just have to figure out how to get rails/bundle/related processes to use your installed version of ruby, rather than the system installation. That will differ depending on the way you installed it.

As an example, I was getting similar error messages, and happened to be using the rbenv ruby package manager, so I had to make rbenv use ruby installed via rbenv, rather than the system installation (to do that, I ran rbenv versions to show the installed versions, then rbenv global 3.0.3 to switch to one of the self-installed versions). What you have to do may be completely different, depending on how you installed ruby, but ultimately you almost certainly want to get rails/bundler to use your self-installed ruby, rather than the system installation which it's currently trying to use.

Upvotes: 1

Zach Tuttle
Zach Tuttle

Reputation: 2341

It looks like you are using the system Ruby that ships with MacOS. In order for this to work you would need to try running these commands with sudo. You can also try installing Ruby with RVM(https://rvm.io/) then running those same commands without sudo

RVM makes it very easy. Run this from your terminal:

\curl -sSL https://get.rvm.io | bash -s stable --ruby

This command will install RVM and the latest stable Ruby version now 2.6.3.

Upvotes: 11

Related Questions