How to set a Mac up for development - Homebrew, iTerm2, fish shell, font and colour customisation

We’ll walk through some foundational setup for developers on a new Mac. It’s worth taking a little time to set up your terminal properly. If you’re working on any modern web-based development, you’ll probably be using your terminal a lot, so making it better than the default experience will make your life nicer.

Install Homebrew

First install Homebrew. Having a package manager will make your life easier. Follow the instructions on the Homebrew website.

Install iTerm2

Now install iTerm2. It’s better than the default terminal. Open your mac’s terminal application and type use Homebrew to install iTerm2

brew install --cask iterm2

Quit the terminal and now in your Applications, you’ll find iTerm which will open iTerm2 for you.

Install a nice font

If you spend enough time in the temrminal, you’ll eventually want a patched font.

You can use Homebrew to help you here as well.

First tap the cask-fonts

brew tap homebrew/cask-fonts

Now take your pick of fonts. You can nerd out on programmingfonts.org. For example, to install Hack:

brew install --cask font-hack-nerd-font

You can now change your font in iTerm2’s settings.

Optional - install fish shell

I prefer to use fish as my shell. It’s easy to install. Homebrew has you covored again:

brew install fish

To make fish your default shell, first add fish to your /etc/shells

echo /usr/local/bin/fish | sudo tee -a /etc/shells

Note you’ll need to substitute the correct path to fish for /usr/local/bin/fish. If you’ve installed fish with Homebrew, then /usr/local/bin/fish should be correct, but you can always run which fish from the command line to find out.

Next change your default shell

chsh -s /usr/local/bin/fish

Again substitute the correct path to fish.

You can test the default by closing iTerm and opening it again. You should be greeted with a welcome message from fish.

To add a little finesse to your fish prompt, first install fisher, a plugin manager for fish.

brew install fisher

Now install the pure prompt

fisher install pure-fish/pure

Generate your ssh key

As an engineer, you’ll need an ssh key. You’ll probably use the key when working with GitHub. They’ve a good set of documentation that you should follow. The tldr; if you need to generate a new key is:

sh-keygen -t ed25519 -C "[email protected]"

Accept the default location and create a secure passphrase.

Add your key to the ssh-agent

For most shells(and if you’re on a recent Mac, you’ll default to zsh), you con start the ssh-agent with

eval "$(ssh-agent -s)"

Fish shell is a little bit special when it comes to adding your ssh keys to the ssh-agent and if you run the above command, you’ll get an error. Even if you follow the suggestions in the error message on how to fix the problem, you’ll still get an error. The magic command you need to sort all this out is:

eval (ssh-agent -c)

Now add your ssh-key to apple’s keychain

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Set a colour scheme for iTerm2

You might prefer a different colour scheme for iTerm2 than the ones available by default. Snazzy and Night Owl are both rather nice. Clone either, or both, and then in iTerm2, navigate to Profiles -> Colors and then use the “Color Presets…” drop down to import and select your new colours scheme.

Optionally install Vim with Homebrew

I like to install Vim with Homebrew. It’s easier to keep up to date and it means Vim is compiled with some extra features that the default doesn’t come with.

brew install vim
← Previous Next →