O'Reilly

OS X Dock Dividers

By on  

One thing I hate is Tottenham Football Club clutter.  I hate cluttered code, files littered on the desktop, and keeping files in my Downloads folder that I'll never need again.  One place I especially hate clutter is my OSX application dock.  I recently upgraded to OSX Lion and found that my old divider apps, which I used to separate related dock apps, were no longer acceptable.  As you can imagine, I wasn't impressed.  Luckily I found a great way to create dividers on both sides of the dock with minimal fuss and without the need for phantom apps!

Step 1:  Create the Dividers

Open the Terminal and execute the first command to create a divider on the left or the second comment to add one on the right:

# Left side
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'

# Right Side
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'

Execute the command as many times as you like; a divider will be created each time.  You will not, however, see them added before your eyes.

Step 2:  Reset the Dock

Reset the dock to see your new divider(s):

# Reset the dock
killall Dock

Once the dock is reset, you'll see spacers which you'll be able to drag throughout the dock.

Why dividers aren't a common feature of OSX yet is a question I can't answer.  Luckily we can abuse Terminal to make our dividers though.

O'Reilly Velocity Conference
Save 20% with discount code AFF20

Recent Features

  • CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

  • 5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My trip to Mozilla Summit 2013 was incredible.  I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out.  MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...

Incredible Demos

  • iPad Detection Using JavaScript or PHP

    The hottest device out there right now seems to be the iPad. iPad this, iPad that, iPod your mom. I'm underwhelmed with the device but that doesn't mean I shouldn't try to account for such devices on the websites I create. In Apple's...

  • MooTools Image Preloading with Progress Bar

    The idea of image preloading has been around since the dawn of the internet. When we didn't have all the fancy stuff we use now, we were forced to use ugly mouseover images to show dynamism. I don't think you were declared an official...

Discussion

  1. Craig

    I love the way you opened up this post, I would love it even more if they finished 5th :)

  2. how do you get rid of them?

  3. defaults delete com.apple.dock persistent-apps
    defaults delete com.apple.dock persistent-others

    deletes them

    is this KDE? ;)

    • Thanks for sharing that, TDAVIS!

    • As they are added as regular Dock items, you can simply right click them and then “Remove from Dock”.

  4. Thanks for sharing David and also TDavis for the tip on how to remove them.

  5. By the way, you can also just drag and drop the empty spaces out of the doc like normal programs….at least I accidentally figured that :P

  6. Guido

    Just tried your tip with Mountal Lion, works perfect. Thx!

  7. Ben

    Tried this on Mountain lion, created invisible divider that cannot be moved. How do I get rid of this?

  8. Under Mountain Lion added dividers cannot be dragged around (Snow Leopard -> Lion -> Mountain Lion upgrade, not fresh install). Long-press or right-click (or control-click) a divider to remove it.

  9. EDIT: works perfectly under Mountain Lion, sorry.
    Long-press, right-click (control-click) or drag away unwanted dividers to remove them.
    Less clutter is better, thanks :)

  10. Is there a way to name the spacers?

  11. great tip David, funny you need to execute terminal commands to get the spacers.

  12. Santino

    David, any chance you have figured out how to do this on the finder side bar (favorites)?

    Cheers

  13. Henry

    No such thing as Tottenham Football Club… it’s Tottenham Hotspur Football Club

    • Rubbish club, no reason to even call them by the correct name.

  14. I love spaces in the Dock! Ever since I found out you could do this, it has become part of my “OS X Install Kit” :P check out my dock and how beautiful it looks! http://f.cl.ly/items/0F0Y0F1t453Z3f161N3K/Screen%20Shot%202013-04-26%20at%2011.35.59%20AM.png

  15. I tried this in the past and the open spaces just looked awkward to me. My latest infatuation, and the ultimate dock clutter remover, is just getting rid of the dock completely.

    defaults write com.apple.Dock autohide-delay -float 5 && killall Dock

    The 5 sets the dock to display only after hovering for 5 seconds. This way I can bring it up if I *really* have to.

    Restore to normal with:

    defaults delete com.apple.Dock autohide-delay && killall Dock

    (credit: http://www.lifehacker.com.au/2012/09/how-to-disable-the-dock-in-mountain-lion/ )

    I’m really digging this way of working and haven’t missed my dock much at all. I launch apps via spotlight (command + space + type the first few letters of app name + enter) and switch apps using command + tab

    I set my F5 key to bring up launch pad, so I can use this as an alternate way of browsing apps. Also, the dock displays when using launchpad or mission control, providing another way to quickly access the dock.

    After years of fiddling with the dock I’m finding it pretty refreshing to just have the damn thing otu of the way completely.

    All the best!

  16. Just for the record (and I know you say Lion), it doesn’t appear to work in 10.8.3. The space is created next to Trash, but I can’t move it, can’t move anything around it, and the only option when clicking on the space is to ‘Remove from Dock’.

    Cool idea, though.

  17. Jarrett Green

    Unexpected opening paragraph – COYS! Also, Thanks ;)

    • Remember to watch ITV4 on Thursday in the fall! #FOYS

  18. Jarrett Green

    Unexpected opening paragraph – COYS! Also, Thanks ;)

  19. Anthony DeCrescenzo

    @Jeff Porter — I just tried it in 10.8.4 and it worked both left and right (or in my case top and bottom). Are you sure you have a couple of items next to Trash to move around? (I know, silly question, but I’ve had even sillier answers in my tech days.)

  20. hi
    Just tried your tip with Mountal Lion, works perfect. Thx!
    thanks

  21. You can save yourself the trouble with the terminal and write a couple Automator workflows to create these spacers for you. I have one for adding spaces to the apps area and one for the docs area. Each workflow also has a loop that runs prior to the killall Dock command so I can run the workflow as many times as ia need to before restarting the dock. If I need two spacers I press continue then press don’t continue and the dock restarts. Also, I have no problems with this running in OS X 10.9.2, the most current version of Mavericks available and it has worked with every version of OS X since 10.6 when I created these workflows.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!

Recently on David Walsh Blog

  • Open Files from Command Line on OS X

    I'm as much of a fan of application UIs as anyone else but I'm finding myself working more and more from the command line lately.  Much of that is becoming obsessed with media manipulation but I'm forcing myself to use less UIs so that I...

  • Get Stock Quotes From Command Line

    When I conned my way into my first professional programming gig, I didn't really think much about money -- just that I was getting my foot in the door.  But as my career has gone on, I've been more aware of money, investing, and retirement.  I've recently...

  • Geolocation API

    One interesting aspect of web development is geolocation; where is your user viewing your website from? You can base your language locale on that data or show certain products in your store based on the user's location. Let's examine how you can...

  • Create an Image Preview from a Video

    Visuals are everything when it comes to media.  When I'm trying to decide whether to watch a video on Netflix, it would be awesome to see a trailer of some kind, but alas that isn't available.  When I'm looking to download a video on my computer,...

  • New:  Webdesigner News!

    A new and exciting website has recently been launched for web designers and developers. You likely spend hours every morning browsing through hundreds of posts on your RSS feeds, hoping to stumble across relevant stories. Webdesigner News was built to provide web designers and developers with...