0

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.

Scott Zhu
  • 8,341
  • 6
  • 31
  • 38
  • 1
    From the [docs](https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x): *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.* – Stefan Aug 06 '13 at 15:05

3 Answers3

4

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.

neojin
  • 212
  • 1
  • 6
1

This maybe has to do with your $PATH. Have you edited your .bash_profile to prepend the rbenv's path?

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

Basically, I recommend you to make sure you've done steps 2-6 from the instructions: https://github.com/sstephenson/rbenv#installation

Agis
  • 32,639
  • 3
  • 73
  • 81
0

Yes, after i typed

eval "$(rbenv init -)"

in my terminal, It works.

Scott Zhu
  • 8,341
  • 6
  • 31
  • 38