0

On my Mac I have an issue with the Ruby version. Most likely this is the cause of "permission denied" errors I get (for the continues-integration Pipeline I try to set up on my Mac) and also for other issues...

I tried to install the newest Ruby version on my macOS.

My steps:

rbenv install -l

(I can see 2.6.2 as newest version, so I continue with this...)

rbenv install 2.6.2

rbenv global 2.6.2

gem update --system

After this step, I get the following error:

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

rbenv versions gives 2.6.2 (as expected)

ruby --version gives ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]

The two don't match !

Do you have any idea what this FilePermission-Error means and how to overcome this ?? How do I get rid of this FilePermission-Error due to Ruby version mismatch ??

iKK
  • 6,394
  • 10
  • 58
  • 131
  • Oh, I was not aware of this. Anyway with [the help of this post](https://stackoverflow.com/a/25716203/3826232) (i.e. using `chruby`) I was finally able to install a new ruby-version on my Mac. This got rid of the ruby-version mismatch and "permission denied" error I was dealing with before. So I guess, `rbenv` was not really necessary in the first place. The real cause was ruby-version mismatch. Do you know, in general, if it is a good idea to change a Ruby-Version on a Mac ? (it seems that MacOS does not really like this). Thanks. – iKK Mar 29 '19 at 19:09

1 Answers1

0

Try to first run rbenv rehash see documentation here

lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • With the help of [this post](https://stackoverflow.com/a/25716203/3826232) (i.e. using `chruby`) I was finally able to install a new ruby-version on my Mac. This got rid of the ruby-version mismatch and "permission denied" error I was dealing with before. So I guess, rbenv was not really necessary in the first place. Or does your `rbenv rehash` proposal do the same as i did with `chruby` ?? The real cause was ruby-version mismatch. Do you know, in general, if it is a good idea to change a Ruby-Version on a Mac ? (it seems that MacOS does not really like this). Thanks. – iKK Mar 29 '19 at 19:12
  • @iKK churby, rvm and rbenv are all Ruby version managers and have different pro/cons. You should only use 1 one of them. By using a version manager you need not mess with OS system ruby, nor should you. – lacostenycoder Mar 29 '19 at 21:39
  • Also https://github.com/rvm/rvm and https://github.com/rbenv/rbenv are highly maintained, but I see last commit on churby is 2017... https://github.com/postmodern/chruby – lacostenycoder Mar 29 '19 at 21:42