Skip to content

Mac OS X Setup Guide

conorom edited this page Apr 27, 2022 · 42 revisions

These are the steps I took to setup a heliotrope development environment on a MacBook Pro (Retina, 13-inch, Early 2015) running OS X El Capitan (Version 10.11.6) in August of 2016.

This guide assumes you have Admin privileges on your MacBook Pro and no development tools installed. For detail instructions on how to setup each individual tool I'll refer you to Sourabh Bajaj who wrote an excellent open source book Mac OS X Setup Guide that gives step by step instructions on setting up a developer environment on Mac OS.

Disclaimer: There are more ways than one to skin a cat, so are there more ways than one to setup your development environment? I have no interest in promoting one tool over another these are simply the tools I chose and the steps I took. Feel free to substitute equivalent tools of your choice as you deem necessary.

Note: You could install Homebrew (or MacPorts) first and then use it to install everything else to manage multiple versions of all your tools!


I already had Xcode installed but in the past I've installed from the App Store. Sourabh installs Xcode from the command line then immediately installs the Xcode command line tools.


When I attempted to use Git for the first time from the command line I was walked through installing the Xcode command line tools which includes Git. Sourabh uses Homebrew to install Git.


To install Homebrew I just cut and pasted the command as per instructions on the website. Sourabh seems to have done the same thing.


The first thing I did was install jenv using Homebrew which is a lot like rbenv. Once jenv was installed I used the jenv add command to get the latest version of Java from Oracle. Sourabh directly installs Java from Oracle. This is optional though. Just download and install Java 8 runtime and you should be good.


The first thing I did was install rbenv using Homebrew.

We need a bunch of packages from Homebrew. Openssl is one to watch. Many gems need this and there is an incompatibility with openssl 1.0.x in newer Ruby versions. So I'll list that one separately, because it gives a message about how to ensure other gems use the Homebrew 1.1.x version of openssl which saves you a lot of headaches.

brew update
brew install openssl rbenv ruby-build rbenv-default-gems
# add the following to ~/.bash_profile as per message from ruby-build installer
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"

Then I installed a version of ruby using rbenv.

# list all available versions:
rbenv install -l

# install a Ruby version:
rbenv install <ruby-version from .ruby-version required>

After making the newly installed ruby my active ruby I installed the bundler gem.

# set active ruby version:
rbenv global <ruby-version, probably best to use same as .ruby-version>

# install bundler gem:
gem install bundler

Sourabh installs a few other things as well, including rails.


brew update # if you didn't just do it already

# now I'll just chain all the other Homebrew packages here
# note 1: yarn also installs node at a much higher version than the production machines but it doesn't seem to matter
# note 2: the Java port is the only pdftk in Homebrew, the installer mentioned in this SO post may be closer to what's in production:
# https://stackoverflow.com/a/60889993
# ... so using that is an alternative option for your dev environment
brew install mysql clamav ffmpeg qpdf imagemagick v8 yarn redis pdftk-java

bundle install

bundle exec rake webpacker:compile

Updating Ruby

We're now using point versions of Ruby and need to update several times per year. Many of the generic install instructions for Ruby above still apply but I'll add this section as well.

cd heliotrope
# note: best to stop mysql before starting this with `mysql.server stop` to avoid problems
# also stop Solr dev server to minimize the risk of your core will get blown away when restarted
# just stop everything before doing this!
brew upgrade rbenv ruby-build
rbenv install --list-all # hopefully not needed as the version you want is now available
cat .ruby-version
rbenv install 2.x.y # whatever version was in .ruby-version
# wait an absolute age
gem install bundler
bundle install
# wait absolute age part deux, then work around dodgy native extensions gems (probably just `therubyracer`, see above) if needed and `bundle install` again

Useful commands

# start from scratch.... delete all Rubies, gems and Homebrew packages
rbenv versions
rbenv uninstall 2.x.y # do for all versions
brew remove --force $(brew list)
rm -rf /usr/local/lib/ruby

# update package lists
brew update

# checking what Homebrew packages are installed
brew ls --versions <package name>

# checking what Homebrew packages are available
brew search