Skip to content

Instantly share code, notes, and snippets.

@siamkreative
Last active November 2, 2022 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siamkreative/86dba65c49ec7b8cb1c107a2dedf2dc8 to your computer and use it in GitHub Desktop.
Save siamkreative/86dba65c49ec7b8cb1c107a2dedf2dc8 to your computer and use it in GitHub Desktop.
Quick guide on how to install Ruby on a MacBook M1

Install Ruby on a MacBook Air M1

Prerequisites

  • You already have brew installed (you can double check that everything is setup with brew doctor).
  • Make sure you don’t have RVM, rbenv, or asdf installed (read this)

Installation Steps

  1. Run ruby-install 3.1.2 -- --enable-shared (taken from this article)
  2. Install Rails with chruby and ruby-install: brew install chruby ruby-install
  3. Install a specific version of Ruby: ruby-install 3.0.1 -- --enable-shared
  4. Configure your Shell:
echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc
echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc
echo "chruby ruby-3.0.1" >> ~/.zshrc
  1. Quit and relaunch Terminal, then check that everything is working by running ruby -v (which should return ruby 3.0.1)

Troubleshooting

If running into issues with database stuff (like "Could not find gem ‘pg (~> 0.18)’)" or "Unable to find PostgreSQL client library"), ensure you install the following:

brew install postgresql libpq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment