How to Install Ruby on Rails on Mac

How to Install Ruby on Rails on Mac

The simplicity of this software developer in forms of Ruby as a language program and Rails as framework are what make this preferred by many. For those who want to learn more about this amazing software developer, it would be better to install Ruby on Rails beforehand.

In this article, we give you a guide on how to install Ruby on Rails on MacOS. As there are lots of tutorials on how to install Ruby on Rails everywhere, we will only give you the summary and important points to be noticed.

1. Upgrade your system to macOS Sierra

You need to upgrade your macOS into MacOS Sierra (version 10. 12.0 or newer) if you want to intsall Ruby. The reason is MacOS only provides developers with pre-installed “system Ruby”. Thus, it would be wise to update Ruby to 2.4.1 version using Ruby Version Manager (RVM).  
RVM is a command-line tool that allows developers to install, manage, and work with multiple ruby environments to sets of gems with an ease. It purposes to make you don’t have to continuously install newer Ruby versions, so RVM is there to help you.

2. Install GPG

Gpg is an encryption program used to check RVM download’s security. If you install gpg, it will eliminate a warning message that usually disturbs the installation of RVM.

$ brew install gpg

After gpg is installed, you also need to install the security key for RVM with this code:

$ command curl -sSL | gpg –import –

3. Install RVM

As we mentioned above, command-line tool Ruby Version Manager (RVM) will help you a lot for managing and working with multiple Ruby environments.

Use this code to install RVM:

$ curl -L | bash -s stable

However, if you have previously installed RVM, you still need to update it to the latest version using this command:

$ rvm get stable –autolibs=enable

4. Install Ruby

After installing the latest version of RVM, you can install the newest version of Ruby by using this code below. Note that you have to type specific version number of the latest version to get it installed:

$ rvm install ruby-(type a version number specifically)

You can also verify whether the latest version of Ruby needs to be installed by using this commad:

$ ruby -v

5. Update RubyGems

As the package manager in Ruby, RubyGems need to be updated in order to add more functionality to Ruby.

Use this command to upgrade the Ruby gem manager.

$ gem update –system

For additional information, many developers install gem installation, Bundler, and Nokogiri to manage gems.

Here’s the command to install gem installation faster:

$ echo "gem: –no-document" >> ~/.gemrc

Command for installing Bundler:

$ gem install bundler

and lastly command for installing Nokogiri:

$ gem install nokogiri

6. Install Rails

We are at the end of our journey! All you have to do is to install the latest version of Rails. You can use this command below to automatically install the most recent release:

$ gem install rails

Here’s the command for installing the newest beta version:

$ gem install rails –pre

And here’s the code if you want the specific version number of Rails:

$ gem install rails –version=(the specific number)

Also, don’t forget to verify if your version of Rails is installed properly by using this code:

$ rails –v

After you’re finished installing Rails, next you need to create Rails applications workspace folder, open terminal application and you can start rails new.

We hope this guidance will help you install Ruby on Rails properly. Comment below if you need a further explanation or add more information.


Scroll to Top
%d bloggers like this: