Adding a separator to the Mac OS X Dock

I’m now developing iPhone apps at work which means developing on a Mac.  It’s quite a shift from Windows, so I’ve been spending time learning the ins and outs to become comfortable with the platform.

One of the things I discovered is that the Dock doesn’t provide a way in the UI to add spacers (dividers) between application tiles.  There are two ways to do this.

Add a dummy application to the Dock

This solution is really simple. Brandon Kelly wrote a very simple application Dock Dividers.  Dock Dividers is simple a collection of do-nothing applications with an application image that looks like a divider.  All you do is simply drag an application to the place in the dock where you want a spacer.  The biggest issue is that you have to make sure you don’t drag the same application to the Dock more than once.

Dock Divider

Use the defaults program from Terminal to add a spacer

The Dock application actually does support the concept of a spacer tile.  Apple just chose not to expose it in the UI.  To add a spacer tile, type the following sequence of commands in a Terminal window:

defaults write persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }
killall Dock

You can add as many spacer tiles as you want.  Once you’re done adding them, execute the killall command to restart the Dock.

Dock Separator

To remove a spacer tile, simply drag it from the Dock, release it somewhere else, and watch it go up in a poof of smoke.

The biggest issue I see with this method is that the spacer tile is simply a space on the dock.  You don’t get to specify an image to make it look nicer.  Hmm… as I think about this, I’m sure there is a way.  Let me know if you figure it out.