How to Install Rails on Mac (M1 and Intel), the Easy Way

Updated

With this updated guide for 2022, you’ll be able to install Rails 7 on your Mac in minutes.

Every day, many people get stuck trying to install Rails on macOS due to outdated, incomplete, and confusing instructions. Especially on Apple Silicon Macs. Today, you’re about to save a lot of time and frustration.

Here are the two best ways to install Rails on a Mac:

Install Rails on Mac with an automated script that does everything for you

To install Rails on a Mac, you first need a proper Ruby development environment. Even though macOS come preinstalled with Ruby, it’s not recommended to use the version that came with your Mac, known as the system Ruby. To learn more, read why you shouldn’t use the system Ruby.

Setting up a proper Ruby development environment on a Mac involves several steps, which many people fumble when trying to follow long tutorials or videos. You might get confused about which shell you’re using, or why you’re getting a “Rails is not currently installed on this system” error even after successfully installing Rails.

To eliminate any chance of human error, I built Ruby on Mac, a reliable script that automates the whole process with a single command, and with a perfect result every time. It also automatically installs Rails and all the other development tools you’ll need.

It doesn’t just have a one-time use. You can run it over and over to keep your dev tools up to date and secure. And the next time you get a new Mac, it will save you a whole day because it can also automatically install all your Mac apps, fonts, macOS preferences, and GitHub repos, in addition to a complete development environment. You get all of these time savings now and in the future for a one-time cost.

If you’re trying to set up Rails on a work computer, you should be able to expense the one-time cost of Ruby on Mac.

Read what people say about the script.

Install Rails on Mac manually with a Ruby version manager

While there are various ways to install and use Ruby on a Mac, there’s only one method I recommend: by installing a separate version of Ruby using a version manager. To learn more, read my definitive guide to installing Ruby gems on a Mac.

Over the past ten years, I’ve helped thousands of people set up Ruby on their Mac. From clean Macs to the most obscure issues, I’ve seen and fixed it all. And the most reliable solution is to use a version manager, specifically chruby.

If you haven’t yet tried to install Ruby or other development tools on your Mac, you should be able to get up and running with the basics by following my step-by-step guide for installing Ruby on a Mac.

This is the manual equivalent of the “Basic” version of Ruby on Mac, minus the comprehensive troubleshooting guide. You’ll then need to manually install the Rails gem, and all the other necessary tools for Rails.

If you’ve already tried to set things up and you’re running into issues you can’t figure out, you can still try my step-by-step guide, but Ruby on Mac will get you unstuck much faster.

Install Rails

Once you have a proper Ruby development environment, you should be able to install the Rails gem and create a new Rails site.

First, make sure you’re using the desired version of Ruby. If you’re creating a brand new Rails site, I recommend 3.1.2.

ruby -v

If the command above shows a version you weren’t expecting, switch to the desired version. For example:

chruby 3.1.2

Then install Bundler and Rails:

gem install bundler rails

Create a new Rails app

cd into the folder where you keep all your projects. For example:

cd ~/projects

Make sure you’re using the desired Ruby version. Example:

chruby 3.1.2

Generate a new Rails app, replacing my-rails-app with your desired name:

rails new my-rails-app

Then cd into your new app:

cd my-rails-app

You should now be able to run the Rails server:

bin/rails s

and visit your Rails app at http://localhost:3000.

Further reading

Once you have your Rails app up and running, I recommend reading about the first gem you should add to your Rails app.