Skip to content

Instantly share code, notes, and snippets.

@bankair
Created September 29, 2022 07:28
Show Gist options
  • Save bankair/b1e381e6559e43ba059a12388f9d7922 to your computer and use it in GitHub Desktop.
Save bankair/b1e381e6559e43ba059a12388f9d7922 to your computer and use it in GitHub Desktop.
Tips for ruby for M1 macbook

How to setup on Mac M1

Install Xcode Command Line Tools

xcode-select --install

Remove brew if you have it already

Install Rosetta2

softwareupdate --install-rosetta

Install brew

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Make sure you add the new Homebrew binary path to your bash/zsh config

echo 'export PATH=/usr/local/homebrew/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

Install rbenv and ruby-build

brew install rbenv ruby-build

Install ruby 2.7.0

RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC arch -arm64 rbenv install 2.7.0

Install node

  • check the needed version in the .nvmrc file, actual is v14.18.3

  • If needed, install nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh
exec zsh
nvm -v
  • Install node@14
brew install node@14
exec zsh
  • restart terminal and use the correct version
nvm use 14.18.3
node -v

Install Yarn

npm install --global yarn
exec zsh
yarn -v

Install Redis

brew install redis

Install PostgreSQL

brew install postgresql
brew services start postgresql

Once you've done that, let's check that it worked:

psql -d postgres

If you enter a new prompt like this one, you're good!

psql (13.3)

To quit it, type \q then Enter.

  • if you need an older version of postgres, like @11
brew install postresql@11
brew services start postresql@11
brew link posgresql@11 --force

Now continue setup at Install Dependencies

If you have an error with ffi on the bundle install command

bundle update ffi

An error occurred while installing pg (0.21.0)?

  • brew install libpq
  • echo 'export PATH="/usr/local/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
  • source ~/.zshrc
  • bundle install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment