Cuelogic Blog Icon
Cuelogic Career Icon
Home > Blog > All > Install Ruby on mac OS using RVM

Install Ruby on mac OS using RVM

RVM lets you deploy each project with its own completely self-contained and dedicated environment–from the specific version of ruby, all the way down to the precise set of required gems to run your application. Having a precise set of gems also avoids the issue of version conflicts between projects, which can cause difficult-to-trace errors and hours of hair loss.

Ruby comes preinstalled on your Mac, Open the Terminal and type:

ruby -v

The version number will return 1.8.7. To install latest version of Ruby, type following command. This command will install RVM first and then we will install Ruby 2.0.0

$\curl -L | bash -s stable --ruby

Note: You should have GIT installed on your machin because program will download some libraries from GIT.

It will take few seconds to install, and next, we need to make RVM available to the shell. We’ll do this by updating our ~/.bash_profile file.

cd ~/
sudo vim .bash_profile

Add following line to your bash profile.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

Now restart Terminal to make sure that everything took effect. To ensure that RVM is correctly installed, type:

rvm list known

It will list down list of Ruby version

For our needs, let’s install Ruby 2.0.0. Type following command to install latest version.

rvm install 2.0.0

It will take some time.

Next, test it by checking the version number:

ruby -v

It should be ruby 2.0.0p195. Now play with latest version of Ruby