How to install RVM and Ruby on Rails on Mac OS X

How to install RVM and Ruby on Rails on Mac OS X

Before installing, make sure you have the required Xcode and Homebrew packages – if you haven't done so yet, see the guide how to install Xcode and Homebrew on Mac.

Installing Ruby

If everything looks good, we can proceed with installing RVM with the latest Ruby version – run the following command in Terminal:

curl -sSL https://get.rvm.io | bash -s stable --rails --autolibs=enable

Wait a couple of minutes for everything to install, then close the terminal. To verify, open a new terminal and run:

type rvm | head -1

If the response is rvm is a function, the installation succeeded. To check the RVM version, use:

rvm -v

The command to check the Ruby version:

ruby -v

The output should be ruby 2.1.0p0 or newer. Learn more about changing the Ruby version with RVM.

Installing Rails

Rails is a standard gem for Ruby – it’s simply an additional library that makes writing web applications in Ruby easier. To install Rails, type in Terminal:

gem install rails

Press Enter and wait for the Rails installation to finish. The command to check the Rails version:

rails -v

The output should be Rails 4.0.3 or later.