Sunday, December 25, 2011

Installing rvm in mac os x lion using bash

They are giving MacBook Pro as our laptop in our office. I wanted to install ruby. For this purpose, I wanted to install rvm. Based on instructions I found in the rvm site, I gave the command to download the installer and do the installation:

$ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
-sh: syntax error near unexpected token `<'

Since this can be split into two commands, I did the same:

$ curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer > rvm-installer
$ bash rvm-installer

When I did this, it threw out a lot of output. Hidden in this output was a line:

Installation of RVM to /Users/[user_name]/.rvm/ is complete.

Once I saw this, I did not bother looking further to see if things have failed or if there are any warnings. Turns out it did not work fine. There was an error in the output:

is_a_function: command not found

When I went ahead and added this path in .bash_profile, the error surfaced again. Google did not help either. Finally, with the help of an answer for my question at StackOverflow, I cracked it:
$ curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
Now to figure out how to install ruby. :)

Cheers!
Karthick S.