This section describes the setup process used to get set up on a Mac OSX development machine, including software and packages to install.

See also:

For an overview of our development approach and philosophy see Principles, General Development, and Rails Development.

Let's get started!

As part of our Ruby on Rails development process, we use asdf for Ruby version and environment management, and Homebrew for package management.

1. Install Homebrew

See docs.

ruby -e "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/master/install>)"

2. Install Homebrew packages

# Common packages.
brew install git node

# dir-env to improve our shell management.
# See <https://direnv.net>.
brew install direnv

# git-flow-avh to help us support the git flow branching model.
# See <https://github.com/petervanderdoes/gitflow-avh>.
brew install git-flow-avh

# git-crypt for managing sensitive information in Git repositories.
# See <https://www.agwa.name/projects/git-crypt>.
brew install git-crypt

# Ctags, for intellisense support via Solargraph.
brew install ctags

# Shopify Theme Kit for developing Shopify themes.
# See <https://shopify.github.io/themekit>.
brew tap shopify/shopify
brew install themekit

# Ngrok, for exposing localhost to the scary internet.
# See <https://ngrok.com>.

3. Install asdf and common dependencies

See docs.

brew install automake autoconf coreutils curl gnupg libtool libxslt libyaml openssl readline unixodbc unzip xz zlib shared-mime-info
brew install asdf

# A Caveat with Mac M1 chip set
# Installation of asdf through homebrew does not come with the lib folder
# You would need to clone/download asdf repository and copy the lib folder into ~/.asdf/

Add to your shell of choice.

4. Install Ruby

See docs.

echo "legacy_version_file = yes" > ~/.asdfrc

# Only Mac with M1 chipset have to run the next export line
# export RUBY_CFLAGS="-DUSE_FFI_CLOSURE_ALLOC -Wno-error=implicit-function-declaration"
# It remove the ffi_prep_closure step when compiling ruby
# <https://github.com/ffi/ffi/issues/869>

asdf plugin-add ruby
asdf install ruby 3.1.2 # You'll need an older version if youre working on Submarine v1 or Hasbro
asdf global ruby 3.1.2