Rvm and ruby version

I have a remote VPS server with Debian 5 running ruby 1.8.7. I installed
rvm and ruby 1.9.2. If I run ‘rvm 1.9.2’ it seems to switch to that
version. But running ruby -v shows the old one. Why?

On Tue, Jan 18, 2011 at 7:25 AM, Paul B.
[email protected]wrote:

I have a remote VPS server with Debian 5 running ruby 1.8.7. I installed
rvm and ruby 1.9.2. If I run ‘rvm 1.9.2’ it seems to switch to that
version. But running ruby -v shows the old one. Why?


Posted via http://www.ruby-forum.com/.

RVM hijacks your ruby by modifying your $PATH

If RVM is switching rubies correctly, but you aren’t seeing it, I assume
your path is not set up correctly to allow RVM to hijack it.

There are a few ways I know that this can happen:

  1. RVM gives you a line to stick in your .bashrc (or .bash_profile, or
    .profile, or possibly other filename, depending on your system). This
    adds
    to the path the locations for the rubies and binaries that RVM is
    maintaining. The line is
    [[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”

  2. If you put that line in, then maybe you haven’t loaded it into your
    current shell session. You can source the file, or restart your terminal
    and
    try again.

  3. If you have a return in your bash profile (I don’t know much about
    bash,
    I assume it returns from the script itself, short-circuiting anything
    that
    would come after it, such as your RVM lines)

If none of that is helpful, try checking out the troubleshooting section
near the bottom of http://rvm.beginrescueend.com/rvm/install/

Josh C. wrote in post #975696:

RVM hijacks your ruby by modifying your $PATH

Of course. I forgot to change that. That explains it. Thanks. :slight_smile: