Search code examples
ruby-on-railsrubymacosrbenv

I want to use ruby1.9.3 in my Mac, but it still using ruby1.8.7 after I installed the ruby1.9.3


As you know, Ruby is pre-installed in Mac and it's version is 1.8.7

[zhuhuihuihui@akematoMac-mini ~] $ ruby --version 
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

For some reasons, i need to use Ruby-1.9.3 instead.

Basically, i followed these steps:

brew update
brew install rbenv
brew install ruby-build
rbenv install 1.9.3-p0
rbenv rehash

Everything works fine, but i still getting the same version(1.8.7) after i installed the 1.9.3 I can use ruby-1.9.3 only if i typed the full path, like this:

[zhuhuihuihui@akematoMac-mini ~] $ ~/.rbenv/versions/1.9.3-p0/bin/ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin12.4.0]

But my system is still using Ruby-1.8.7.

Any help will be appreciated.


Solution

  • I haven't tried installing rbenv with brew, but have you done this part?

    From: https://github.com/sstephenson/rbenv

    Afterwards you'll still need to add eval "$(rbenv init -)" to your profile as stated in the caveats. You'll only ever have to do this once.