Install Ruby On Rails on
macOS 15 Sequoia (Apple Silicon, M1, M2)
A guide to setting up a Ruby on Rails development environment on macOS 15 Sequoia (Apple Silicon, M1, M2)
Operating System
Version
Overview
This will take about 30 minutes.
We will be setting up a Ruby on Rails development environment on macOS 15 Sequoia. 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.
Installing Homebrew
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 https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Installing Ruby
First, we need to install Ruby's dependencies using Homebrew.
brew install openssl@3 libyaml gmp rust
Next, we'll install Ruby using a version manager called Mise. This allows you to easily update Ruby and switch between versions anytime.
curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate)"' >> ~/.zshrc
source ~/.zshrc
Then install Ruby with Mise:
mise use --global ruby@3
Confirm that Ruby is installed and works:
ruby --version
#=> 3.3.5
You also want to ensure you're using the latest version of Rubygems.
gem update --system
Optionally, if you plan to use Node.js for handling assets, you can use Mise to install Node as well.
mise use --global node@22.11.0
node -v
#=> 22.11.0
Configuring Git
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.
git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t ed25519 -C "YOUR@EMAIL.com"
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/id_ed25519.pub
Once you've done this, you can check and see if it worked:
ssh -T git@github.com
You should get a message like this:
Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.
Installing Rails
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 8.0.0
And now we can verify Rails is installed:
rails -v
# Rails 8.0.0
Setting Up A Database
Rails ships with sqlite3 as the default database. You can also use MySQL or PostgreSQL if you'd like.
MySQL
You can install MySQL server and client from Homebrew:
brew install mysql
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.
PostgreSQL
You can install PostgreSQL server and client from Homebrew:
brew install postgresql
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.
Final Steps
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
rails new myapp -d postgresql
# Move into the application directory
cd myapp
bin/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!