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: