OS X Setup Guide

Recently I got a new work laptop. Today I configured it and documented the process. If I make any changes to these instructions I’ll update them in this Gist.

Update: I recently had to set up a new computer, so I took the opportunity to automate a lot of this stuff: https://github.com/bi1yeu/new-macos

Here are the programs and tweaks I first made on a fresh install of OS X 10.11:


Homebrew / Cask

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew tap caskroom/cask
$ brew tap caskroom/versions
$ brew tap caskroom/fonts
$ brew tap tldr-pages/tldr

Rearrage PATHs

This is so that Homebrew-installed tools load instead of built-in ones. git, emacs, etc.

$ sudo vi /etc/paths

Put /usr/local/bin above /usr/bin in the list. Save file and restart terminal.

Install with Cask

$ brew cask install alfred                # https://www.alfredapp.com/
$ brew cask install flux                  # https://justgetflux.com/
$ brew cask install font-source-code-pro  # https://github.com/adobe-fonts/source-code-pro
$ brew cask install google-chrome         # https://www.google.com/chrome/browser/desktop/
$ brew cask install iterm2-nightly        # http://iterm2.com/
$ brew cask install java                  # https://java.com/en/download/
$ brew cask install keepingyouawake       # https://github.com/newmarcel/KeepingYouAwake
$ brew cask install lunchy                # https://github.com/eddiezane/lunchy
$ brew cask install middleclick           # http://rouge41.com/labs/
$ brew cask install osxfuse               # https://osxfuse.github.io/
$ brew cask install spectacle             # https://www.spectacleapp.com/

Install with Homebrew

$ brew install aspell                     # http://aspell.net/
$ brew install git                        # https://git-scm.com/
$ brew install gnupg2                     # https://www.gnupg.org/
$ brew install homebrew/fuse/sshfs        # https://github.com/libfuse/sshfs
$ brew install httpie                     # https://github.com/jkbrzt/httpie
$ brew install jq                         # https://stedolan.github.io/jq/
$ brew install leiningen                  # http://leiningen.org/
$ brew install markdown                   # http://daringfireball.net/projects/markdown/
$ brew install pandoc                     # http://pandoc.org/
$ brew install task                       # http://taskwarrior.org/
$ brew install the_platinum_searcher      # https://github.com/monochromegane/the_platinum_searcher
$ brew install tldr                       # http://tldr-pages.github.io/

launchctl / lunchy

build locate database:

$ lunchy install /System/Library/LaunchDaemons/com.apple.locate.plist
$ lunchy start com.apple.locate.plist

Create plist to periodically run brew update (replace <username> below):

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
      <key>Label</key>
      <string>com.<username>.brew-update</string>
      <key>ProgramArguments</key>
      <array>
          <string>/usr/local/bin/brew</string>
          <string>update</string>
      </array>
      <key>StartCalendarInterval</key>
      <dict>
        <key>Hour</key>
        <integer>2</integer>
        <key>Minute</key>
        <integer>0</integer>
      </dict>
      <key>RunAtLoad</key>
      <true />
  </dict>
  </plist>

And start it:

$ lunchy start ~/Library/LaunchAgents/com.<username>.brew-update.plist

Git configuration

$ git config --global user.name '<your-proper-name>'
$ git config --global user.email <email-address>
$ git config --global core.editor 'vim'

Spacemacs

http://spacemacs.org/

$ brew install --with-cocoa emacs
$ ln -s /usr/local/Cellar/emacs/24.5/Emacs.app /Applications
$ git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
$ git clone https://github.com/bi1yeu/dotfiles
$ cd ~/dotfiles/ && ./link-dotfiles.sh
$ emacs --daemon && emacsclient -c &

Bash prompt

$ brew install bash-git-prompt

Add to .bash_profile:

if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
    source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi

GIT_PROMPT_ONLY_IN_REPO=1

Prefs

Generate SSH key and add it to ssh-agent

$ ssh-keygen -t rsa -b 4096 -C "<email-address>"
$ chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa

Edit iTerm2 settings to bind alt+arrow keys to move forward/backward

https://coderwall.com/p/h6yfda/use-and-to-jump-forwards-backwards-words-in-iterm-2-on-os-x