Setting up my dev environment on a new Mac

Here’s what I do when I get a new Mac / reinstall OSX.

The absolute essentials

  1. Download chrome. Already, everything is synced. Awesome.
  2. Download Alfred. This is my go-to tool for opening just about anything. It’s so good I actually bought the powerpack.
  3. Download Spectacle for easy and powerful window management.
  4. Download iTerm. This is my preferred terminal environment.
  5. Set up a global keyboard shortcut for opening iTerm.
  6. Install homebrew. Once we have this, we have everything. When installing homebrew, it will also install the Apple Command Line Developer Tools. Yay.
  7. brew install all the things. I normally brew install node first as I am a self-proclaimed JavaScript fanboy.
  8. Install Sublime Text 3. Unless you’re a vim wizard. In that case ignore steps 1-7. Vim will suffice.

Make the terminal awesome

Dat terminal do

  1. Download oh-my-zsh. I can’t be bothered explaining the benefits of zsh over bash but you’ll feel the power of zsh as soon as you start using it.
  2. Set up zsh-syntax-highlighting. Gives instant visual feedback to tell you what you’re about to execute is correct. e.g. If you type the command “echo” incorrectly, it will show in red. If you type it correctly, it will show in green (like the above screenshot), before you actually execute the command.
  3. Download tomorrow-night-eighties theme for iTerm2. To do this, save this file as ‘Tomorrow Night Eighties.itermcolors’ and open it. iTerm2 will import it. Then, choose it in iTerm > Preferences > Profiles > Default > Colors > Load Presets…
  4. Set up pure prompt. This will add stuff like nicer git integration, timing functions (see screenshot above), and other neat tricks in your terminal. To do this, save this file as ‘pure.zsh’. Then run:

    1
    mkdir ~/.oh-my-zsh/functions
    ln -s /path/to/pure.zsh ~/.oh-my-zsh/functions/prompt_pure_setup
  5. Restart iTerm.

  6. At this point, I like to set up my zshrc aliases. Sublime Text is an important one. Add this to the end of your .zshrc file:
    1
    alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"

Cool, you can now edit files in your terminal using the subl keyword! (Try it on folders too!)

Other stuff

Set up your ssh keys:

  1. Open a terminal and type ssh-keygen
  2. Repeatedly press enter (feel free to give a password if you want)
  3. Copy your public key and put it into your github account.
    cat ~/.ssh/id_rsa.pub | pbcopy

Set your git user name and email:

1
git config --global user.name "Your Name"
git config --global user.email you@example.com

Set up git lg alias, a better git log:

1
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

JIT App Installations.

A lot of people install all the apps they could possibly need in the future right after they do a fresh install. I used to do this. Then I realised the majority of this time is time wasted. A better approach is to install apps on the fly when you need them. This will save you time, and also some precious disk space! Package and app managers (like npm or the App Store) make installations really quick and easy. So install the essentials and forget the rest!