Install Ruby On Rails on
macOS 15 Seqouia (Apple Silicon, M1, M2)

A guide to setting up a Ruby on Rails development environment on macOS 15 Seqouia (Apple Silicon, M1, M2)

This will take about 30 minutes.

We will be setting up a Ruby on Rails development environment on macOS 15 Seqouia. Ruby can run on Apple Silicon like M1 and M2 chips and Intel Macs just fine. This guide will walk you through setting up Ruby and Rails on Apple Silicon.

First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source.

Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes.

Open Terminal and run the following command:

/bin/bash -c "$(curl -fsSL"

Choose the version of Ruby you want to install:

Next we're going to be installing Ruby using a version manager called ASDF.

The reason we use ASDF over rbenv, rvm or others is that ASDF can manage other languages like Node.js too.

Installing asdf is a simple two step process. First you install asdf, and then add it to your shell:

git clone ~/.asdf
echo '. "$HOME/.asdf/"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
exec $SHELL

Then we can install ASDF plugins for each language we want to use. For Rails, we can install Ruby and Node.js for our frontend Javascript.

asdf plugin add ruby
asdf plugin add nodejs

To install Ruby and set the default version, we'll run the following commands:

asdf install ruby 3.3.3
asdf global ruby 3.3.3

# Update to the latest Rubygems version
gem update --system

Confirm the default Ruby version matches the version you just installed.

which ruby
#=> /Users/username/.asdf/shims/ruby
ruby -v
#=> 3.3.3

Then we can install the latest Node.js for handling Javascript in our Rails apps:

asdf install nodejs 20.14.0
asdf global nodejs 20.14.0

which node
#=> /Users/username/.asdf/shims/node
node -v
#=> 20.14.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarn

We'll be using Git for our version control system so we're going to set it up to match our Github account. If you don't already have a Github account, make sure to register. It will come in handy for the future.

Replace the example name and email address in the following steps with the ones you used for your Github account.

git config --global color.ui true
git config --global "YOUR NAME"
git config --global ""
ssh-keygen -t ed25519 -C ""

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/

Once you've done this, you can check and see if it worked:

ssh -T

You should get a message like this:

Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.

Choose the version of Rails you want to install:

Installing Rails is as simple as running the following command in your Terminal:

gem install rails -v 7.2.0.beta2

And now we can verify Rails is installed:

rails -v
# Rails 7.2.0.beta2

We're going to install sqlite3 from homebrew because we can't use the built-in version with macOS Sierra without running into some troubles.

brew install sqlite3

Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.

There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with.

If you're new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.

If you're coming from PHP, you may already be familiar with MySQL.


You can install MySQL server and client from Homebrew:

brew install mysql

Once this command is finished, it gives you a couple commands to run. Follow the instructions and run them:

# To have launchd start mysql at login:
brew services start mysql

By default the mysql user is root with no password.

When you're finished, you can skip to the Final Steps.


You can install PostgreSQL server and client from Homebrew:

brew install postgresql

Once this command is finished, it gives you a couple commands to run. Follow the instructions and run them:

# To have launchd start postgresql at login:
brew services start postgresql

By default the postgresql user is your current macOS username with no password. For example, my macOS user is named chris so I can login to postgresql with that username.

Mojave changed the location of header files necessary for compiling C extensions. You might need to run the following command to install pg, nokogiri, or other gems that require C extensions:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

And now for the moment of truth. Let's create your first Rails application:

rails new myapp

#### If you want to use MySQL
rails new myapp -d mysql

#### If you want to use Postgres
# Note you will need to change config/database.yml's username to be
# the same as your macOS user account. (for example, mine is 'chris')
rails new myapp -d postgresql

# Move into the application directory
cd myapp

# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified

# Create the database
rake db:create

rails server

You can now visit http://localhost:3000 to view your new website!

Now that you've got your machine setup, it's time to start building some Rails applications.

Getting an "Access denied" error?

If you received an error that said Access denied for user 'root'@'localhost' (using password: NO) then you need to update your config/database.yml file to match the database username and password.

Editing Code

Install VS Code.

Then run Cmd+Shift+P and select "Install 'code' command in PATH". This will add the code command to your shell so you can open up VS Code from your terminal.

Lastly, run this command to configure VS Code as your editor. This allows you to edit Rails credentials in your terminal.

echo 'export EDITOR="code --wait"' >> ~/.zshrc
exec $SHELL

That's it! Let us know in the comments below if you run into any issues or have any other protips to share!

Want to stay up-to-date with Ruby on Rails?

Join 84,256+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.