Skip to content

Instantly share code, notes, and snippets.

@brycejohnston
Last active August 31, 2022 01:15
Show Gist options
  • Save brycejohnston/07e4e8768050b66edc8d97b87b1669ee to your computer and use it in GitHub Desktop.
Save brycejohnston/07e4e8768050b66edc8d97b87b1669ee to your computer and use it in GitHub Desktop.
macOS Ruby on Rails Setup w/ asdf

Setting up Ruby / Ruby on Rails on macOS

If you haven't done so, first install Xcode Command Line Tools (xcode-select --install) and homebrew

asdf setup

Install required dependencies w/ homebrew

brew install \
  git coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl libffi gpg wget yarn redis

Set redis to run as service w/ launchd

brew services start redis

Install asdf version manager w/ git

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.4

Add asdf to your shell

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc

Reload your shell

exec $SHELL

Ruby / Ruby on Rails Setup

Add the asdf Ruby plugin

asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git

Install the latest Ruby and set it as the Ruby for your system

asdf install ruby 2.6.5
asdf global ruby 2.6.5

Reload your shell

exec $SHELL

Verify Ruby version outputs 2.6.5

ruby -v

Tell RubyGems to not install documentation for each gem (optional, but speeds things up)

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Install Ruby on Rails framework

gem install rails

Node.js setup (needed for Rails)

Add the asdf Node plugin and key

asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git

Import Node team's keys

bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring

Install the latest stable Node version and set it as the Node version for your system

asdf install nodejs 10.16.3
asdf global nodejs 10.16.3

Reload your shell

exec $SHELL

Verify Node version outputs 10.16.3

node -v

PostgreSQL

Download Postgres.app and follow the installation/setup instructions on their website.

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