6
votes
❯ rbenv version
system (set by /Users/eric.nguyen/.rbenv/version)
                                                                                                                                                             
❯ rbenv local 2.4.2
                                                                                                                                                           

❯ gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
                                                                                                                                                           
❯ rbenv global 2.4.2
                                                                                                                                                           
❯ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
                                                                                                                                                           
❯ rbenv version
2.4.2 (set by /Users/eric.nguyen/.ruby-version)
                                                                                                                                                           
❯ gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
                                                                                                                                                           
❯ gem -v
2.0.14.1

Ruby version is is still 2.0.0p648

I'm on macOS Sierra 10.12.6.
I've done everything mentioned here

I've done:

  1. rbenv rehash
  2. put eval "$(rbenv init -)" in my .zshrc and source ~/.zshrc
  3. put $HOME/.rbenv/shims into $PATH (/Users/eric.nguyen/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/eric.nguyen/Library/Android/sdk/tools:/Users/eric.nguyen/Library/Android/sdk/platform-tools:/Users/eric.nguyen/.rbenv/shims)

But it still doesn't change ruby version.

2
Make sure you have eval "$(rbenv init -)" in your .bash_profile AND you exit and open a new terminal window (or source .bash_profile in any open windows)Joe
@Joe I already have thatericn
have you issued a 'rbenv rehash' ?mcfinnigan
what's the output for echo $PATH?mikej

2 Answers

5
votes

Restarting my computer resolve the issue.

❯ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]


❯ gem -v
2.6.13
2
votes

You always need to run rbenv rehash after you install a new ruby version using rbenv and also when you install a gem that has a command line options