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. Fatal error: Uncaught Error: Call to undefined function ereg() in /var/www/html/wp-content/themes/thematic/library/extensions/comments-extensions.php:262 Stack trace: #0 /var/www/html/wp-content/themes/thematic/library/extensions/discussion.php(30): thematic_commenter_link() #1 /var/www/html/wp-includes/class-walker-comment.php(180): thematic_comments(Object(WP_Comment), Array, 1) #2 /var/www/html/wp-includes/class-wp-walker.php(146): Walker_Comment->start_el('', Object(WP_Comment), 1, Array) #3 /var/www/html/wp-includes/class-walker-comment.php(140): Walker->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #4 /var/www/html/wp-includes/class-wp-walker.php(371): Walker_Comment->display_element(Object(WP_Comment), Array, '5', 0, Array, '') #5 /var/www/html/wp-includes/comment-template.php(2040): Walker->paged_walk(Array, '5', 0, 0, Array) #6 /var/www/html/wp-content/themes/thematic/comments.php(80): wp_list_comments('type=comment&ca...') #7 /var/www/html/wp-includes/comment-template.php(1430): require('/var/www in /var/www/html/wp-content/themes/thematic/library/extensions/comments-extensions.php on line 262