RVM Multi-User on Debian Problem

By Morten Møller Riis

July 01 2011 13:25 CET

Wayne E. Seguin’s RVM is a great tool for managing your Ruby installations. Especially when developing it is nice to be able to switch environments and try out eg. your Rails app in REE, RBX, 1.9.2…

However, setting up a multi-user environment on a Debian server today left me stumped.

Using the installation script and thereafter install Ruby 1.9.2p180 worked great. But then I ran into this:

            	 root@debian:/# ruby -v
            	 ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
            	 root@debian:/# rvm use 1.9.2
            	 Using /usr/local/rvm/gems/ruby-1.9.2-p180
            	 root@debian:/# ruby -v
            	 ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
              

Not quite what you would expect.

The fix is easy though. From the troubleshooting guide, check the following:

            	 root@debian:/# type rvm | head -1
            	 rvm is hashed (/usr/local/bin/rvm)
              

Whoops! This should be function and not hashed. Okay, it seems the RVM script isn’t sourced correctly.

Add this to the end of your /etc/profile:

            	 source /usr/local/rvm/scripts/rvm
              

And reload it or restart your server ;)

Now you should get:

            	 root@debian:/# type rvm | head -1
            	 rvm is a function
              

Badabing! We are in business:

            	 root@debian:/# rvm use 1.9.2 --default
            	 Using /usr/local/rvm/gems/ruby-1.9.2-p180
            	 root@debian:/# ruby -v
            	 ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]