13 June 2012

Installing Ruby on Mac OS

STEP 1 Installing XCode

Please install XCode + Developer Tools from the App Center.
XCode is needed to install the Developer tools used in compilation of the Ruby packages for installation on the system.

STEP 2 Install RVM

Install RVM using the command
  • curl -L get.rvm.io | bash -s stable
This will install RVM on your system.
Please close and open the terminal again to load RVM.
To verify the RVM installation , open Terminal and type
  • rvm requirements
This will show a help doc.

Step 3 Installing required RVM packages before installing Ruby

Open Terminal and run the below mentioned commands one after the another
  • rvm pkg install zlib
  • rvm pkg install openssl
  • rvm pkg install iconv
  • rvm pkg install readline
  • rvm pkg install autoconf

Step 4 Installing Ruby

Open the Terminal and type the following command
  • rvm install 1.8.7 --with-gcc=clang
Here 1.8.7 reflects the Ruby version 1.8.7 and the latest patch, so to install any specific version or path you specify it by altering the above mentioned command eg.
  • rvm install 1.8.7-p334 --with-gcc=clang
  • rvm install 1.9.3 -C --with-gcc=clang

Step 5 Verify the installation

Open a new Terminal window and type
  • rvm list This will display the list of the different rubies installed on the system.
    To use a specific Ruby version use the following command
  • rvm use 1.8.7
  • rvm use 1.8.7-p334
  • rvm use 1.9.3 To make a Ruby version default for the system use the command
  • rvm alias create default 1.8.7
  • rvm alias create default 1.8.7-p334
  • rvm alias create default 1.9.3
This Ruby version will be the default version of Ruby on the system , to change to other versions of Ruby use the above mentioned commands.
To use default incase of switching use
  • rvm use default
To remove RVM from the system use the command
  • rvm implode

No comments:

Post a Comment

Any inputs are welcomed : ashish.cse2010@gmail.com