3

I followed this guide: http://samsoff.es/posts/how-to-install-ruby-193

I typed rbenv install 1.9.3-p125 in the console.

Ruby installs OK but when I run ruby -v it still says version 1.8.7.

What needs to be changed for it to work?

4 Answers 4

3

The solution was to add eval "$(rbenv init -)" to my bash_login file.

1

You need to switch to the new version, one of three ways:

  • temporarily: rbenv shell 1.9.3-p125 set a .rbenv-version file in
  • the current directory: rbenv local 1.9.3-p125 set the default
  • version for your user: rbenv global 1.9.3-p125
8
  • And, conversely, to return to a system version use rbenv global system, where "global" could also be "shell", "local". Commented Apr 23, 2012 at 19:03
  • Yes thats in the tutorial, I did rbenv global 1.9.3-p125 but ruby -v still says 1.8.7?
    – mdc
    Commented Apr 23, 2012 at 22:21
  • What is the output of rbenv version and rbenv versions ? Commented Apr 23, 2012 at 22:56
  • OK this line: eval "$(rbenv init -)" switches the ruby version. After I type that and then ruby -v I get ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] - BUT - after I restart the terminal and type ruby -v again its back to 1.8.7? What can I do to make it permanent?
    – mdc
    Commented Apr 24, 2012 at 18:33
  • 1
    looks line whatever file you put the eval stuff in isn't being loaded when your shell starts. as en experiment put echo "hello!" right after it and see if that is printed when you start a new window/shell/terminal. Commented Apr 24, 2012 at 20:05
1

If the install command isn't working for you with rbenv, you have to install ruby-build.

0

you should restart the terminal to allow rbenv

$ exec $SHEL
$ ruby -v

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

Not the answer you're looking for? Browse other questions tagged or ask your own question.