THE BLOG

Effective Development On a Mac

04/10/2014 11:06 am ET | Updated Jun 09, 2014

A lot of developers use Macs these days because it's the hot new thing. Unfortunately Macs are not the greatest development platform in the world out of the box. You need to do just a little bit of work to take your fancy new Macbook and turn it into a lean, mean, bug-crushing machine.

The Tools

  1. Homebrew: OS X's missing package manager
  2. iTerm: A better and more powerful terminal
  3. Slate: or another window manager

Homebrew

Homebrew is the missing package manager of OS X. It's drastically better and more actively developed than its two competitors fink and ports. If you are coming from a Linux world you can think of brew as yum, apt-get, rpm, or emerge.

To facilitate its installation we're going to update our path to make sure that /usr/local/bin is always ahead of /usr/bin. This means the shell will look for homebrew installed packages before looking for the system packages. This is desirable because OS X's system packages are often old or frustratingly modified. It also gives us a happy sandbox to work in that won't bork our system!

So open your ~/.SHELLrc where SHELL is bash, zsh, etc. and change the path like so:

export PATH=/usr/local/bin:$PATH

Simple right?

Make sure you're not exporting the path a whole bunch of times (might have happened if you've had the machine for a while and installed some silly things).

Now we just install homebrew as documented here: http://brew.sh/#install

We can then install a package as simply as: brew install python.

We can see what options a package exposes with brew info python.

iTerm

This one is easy to do. Download.

I find it useful to set a global hotkey for the terminal and I typically use CMD+~ because I have a habit of using that hotkey from years of videogames.

But why is the default terminal on OS X not sufficient? Have a link or path in the terminal you want to open in Finder or your browser? CMD+Click will do that. Autocompletion for everything in any context? iTerm has you covered. These are just a few of the many reasons to use iTerm. I'll Just leave this link here for more highlights.

You can also open anything with whatever OS X thinks the default tool is with the open command.

Slate

Do you frequently use your mouse to move windows around? Stop it. Every time you do that you're wasting time trying to get the OS to do something that it should be smart enough to do on its own.

With slate you can move windows around like a pro. Tile 3 windows next to each other? One key combo. Use one quarter of the screen? Done. Center a window and make it a certain size? Done.

Slate can be very complicated to get moving with though so I'd also recommend sizeup, divvy, Spectacle, and shiftit.

To get you up and running with slate quickly checkout my dotfiles: https://github.com/ranman/dotfiles/blob/master/.slate

To move a window:

  • left-half: CMD+ALT+CTRL+LEFT
  • right-half: CMD+ALT+CTRL+RIGHT
  • top-half: CMD+ALT+CTRL+UP
  • bottom-half: CMD+ALT+CTRL+DOWN
  • left-top-quarter: SHIFT+CTRL+ALT+LEFT
  • left-bottom-quarter: SHIFT+CTRL+ALT+DOWN
  • right-top-quarter: SHIFT+CTRL+ALT+UP
  • right-bottom-quarter: SHIFT+CTRL+ALT+RIGHT

CMD+E will bring up a task switcher and CMD+SHIFT+G will bring up a window drawer.

Other Tools

What I've outlined above is enough to save you cumulative hours a week. If you'd like to go further here are a few tools I find speed my development:

  • sublime: a great and full featured editor (get package control! right away), almost as good as vim.
  • silver-searcher: a better ack that's aware of your sourcecode.
  • oh-my-zsh: ZSH is a cool shell and oh-my-zsh has a lot of nice plugins.
  • alfred: indispensable application launcher and multi-tool. It also can store your clipboard history!
  • textual: IRC client.
  • adium: IM client.
  • ipython: iPython is a great python repl and the notebook feature is indispensable.
  • dash: an offline documentation browser, great for a developer on the go.

I've also collected a well documented list of OSX hacks over the years that make things a lot easier (key repeat rate, autocorrect, etc.). You can look at all of those here: https://github.com/ranman/dotfiles/blob/master/.osx