System Tools

Homebrew

Homebrew is the de-facto package manager for Mac OS X. Most other setup instructions depend on having brew installed.

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

Setup ~/.bash_profile.d

The goal is to make it easier to customize environment variables by adding/overwriting files in the ~/.bash_profile.d directory. Most other setup instructions depend on all files in the ~/.bash_profile.d directory to be automatically sourced when the shell is started

mkdir -p ~/.bash_profile.d
cat > ~/.bash_profile << 'EOF'
for f in $(find $HOME/.bash_profile.d -type f | sort) ; do
  source "$f"
done
EOF

bash-completion

Programmable completion functions for bash

Most commands (git, …) provide advanced tab-completions to make your life easier. To make use of this mechanism, it needs to be activated.

Install with Homebrew

brew install bash-completion

Enable

cat  > ~/.bash_profile.d/bash_completion << 'EOF'
if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi
EOF
source ~/.bash_profile.d/bash_completion

asdf-vm for Python, Ruby, NodeJS, Terraform

asdf-vm is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like gvm, nvm, rbenv & pyenv (and more) all in one!

brew install asdf
echo "source $(brew --prefix asdf)/asdf.sh" > ~/.bash_profile.d/zzz_asdf
source $(brew --prefix asdf)/asdf.sh
echo "legacy_version_file = yes" > ~/.asdfrc

# Install Python
asdf plugin-add python https://github.com/danhper/asdf-python.git
asdf install python 3.7.3
asdf global python 3.7.3

# Install Ruby
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby 2.6.3
asdf global ruby 2.6.3

# Install Node
brew install coreutils gpg
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install nodejs 12.2.0
asdf global nodejs 12.2.0

# Install terraform
asdf plugin-add terraform https://github.com/Banno/asdf-hashicorp.git
asdf install terraform 0.11.14
asdf global terraform 0.11.14

Docker

Docker is used to run local MySQL instances for the frontend and db-schema projects

brew install docker docker-compose docker-machine-driver-xhyve
brew cask install virtualbox
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Git

Git is a distributed version control system

Install the latest version with Homebrew

brew install git

Configure Git

The minimum configuration would look like

git config --global user.name "Your Name"
git config --global user.email you@narrative.io

Generate Git SSH key

ssh-keygen

Then manually upload ~/.ssh/id_rsa.pub to github

Install Hub

Hub provides github-related shortcuts

brew install hub
echo 'alias git=hub' > ~/.bash_profile.d/hub
source ~/.bash_profile.d/hub

Install direnv

direnv is an environment switcher for the shell. It knows how to hook into bash, zsh, tcsh and fish shell to load or unload environment variables depending on the current directory. This allows project-specific environment variables without cluttering the ~/.profile file.

brew install direnv
# Load direnv after everything else has been loaded. In particular after `rbenv` and other shell extensions that manipulate the prompt
echo 'eval "$(direnv hook bash)"' > ~/.bash_profile.d/zzz_direnv
source ~/.bash_profile.d/zzz_direnv