0

Ruby noob here. I installed Ruby 1.9.3 but it still defaults to my pre-installed system version (1.8). For example:

$ gem install rails
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/1.8 directory.

I used rbenv to try to set the global version to 1.9.3

$ rbenv global 1.9.3-p448

But still, I have this issue and when I check the version, I get 1.8:

$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Ben Davidow
  • 1,175
  • 5
  • 23
  • 51

3 Answers3

2

Fixed it by adding the following to .bash_profile:

export PATH="$HOME/.rbenv/bin:$PATH"

Also, this line is needed too (though it was already there):

eval "$(rbenv init -)"

For info on modifying bash_profile, see:

http://redfinsolutions.com/blog/creating-bashprofile-your-mac

Ben Davidow
  • 1,175
  • 5
  • 23
  • 51
0

Use rehash command for rbenv after setting a version.

$ rbenv rehash

https://github.com/sstephenson/rbenv#rbenv-rehash

LukeS
  • 481
  • 4
  • 14
0

Command gem use System gem command, default is superuser. I unused rbenv, but get rbenv path add to environment variables PATH at first, I think is work

jame2981
  • 51
  • 1
  • 6