Installing RVM on Ubuntu 11.04

I’ve been trying to install RVM on Ubuntu 11.04 and what, according to the installation instructions, should have been a fairly straightforward process turned out to be pretty frustrating. I’m no Linux expert, I’m still picking a lot up, but I couldn’t see any reason why, after each install attempt, I got the following error when attempting to run ‘rvm’:

No command 'rvm' found

I’d installed RVM as a single user using the following command:

bash < <( curl https://rvm.beginrescueend.com/releases/rvm-install-head )

The next step involves adding a line to your .bash_profile file (which in the case of Ubuntu is .profile, although the actual change needs to be made in .bashrc):

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

One thing I was warned about during installation was the presence of a return statement in the above file, which I was instructed to refactor into an if statement (I’m assuming this is standard on Ubuntu as my installation is fairly clean):

WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:
if [[ -n "$PS1" ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.

I duly made this additional change but eventually discovered I’d made a key mistake; the closing ‘fi’ statement needs to come before the new RVM line, not after it. Maybe this is a no-brainer to most people, and I know it does refer to the original content in the above instructions, but as somebody without a great deal of Linux experience, it wasn’t particularly clear to me which way round these lines should be, and the matter was further compounded by guidance I found on blog posts and forums that had the RVM line inside the if statement.

So if you’re having issues getting RVM to run, double check .bashrc and see if you’ve made the same mistake I did. Don’t forget to reload your profile after making any changes:

source .profile
This entry was posted in Fixes and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted October 24, 2011 at 4:32 pm | Permalink

    If it’s a fresh copy of Ubuntu, you might need curl before you install RVM

    sudo apt-get install curl

  2. uma mahesh
    Posted February 27, 2012 at 6:14 am | Permalink

    thanks.. its make to know that it needs to install curl first before installing the rvm.

2 Trackbacks

  • By antivirus for ubuntu on April 7, 2012 at 5:34 am

    antivirus for ubuntu…

    […]Installing RVM on Ubuntu 11.04[…]…

  • By real estate colombia on October 12, 2015 at 9:27 am

    real estate colombia

    Installing RVM on Ubuntu 11.04

Leave a Reply