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.

Track.js Error Reporting

Upcoming Events

Recent Features

  • 5 HTML5 APIs You Didn’t Know Existed

    When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It."  Can you blame us though?  We watched the fundamental APIs stagnate for so long that a basic feature...

  • Create a CSS Cube

    CSS cubes really showcase what CSS has become over the years, evolving from simple color and dimension directives to a language capable of creating deep, creative visuals.  Add animation and you've got something really neat.  Unfortunately each CSS cube tutorial I've read is a bit...

Incredible Demos

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

  • Free Download: Font Bundle Featuring 17 Incredible Typefaces

    The only thing we love more than a good font, is a good free font. So we’ve combed the Web for some of our favorite free fonts, and gathered them here in a single download. You’ll find a variety of useful typefaces, from highly geometric designs...

  • OâReilly Velocity Conference â Amsterdam

    My favorite front-end conference has always been O'Reilly's Velocity Conference because the conference series has focused on one of the most undervalued parts of client side coding:  speed.  So often we're so excited that our JavaScript works that we forget that speed, efficiency, and performance are just as important. The next Velocity...

  • CanIUse Command Line

    Every front-end developer should be well acquainted with CanIUse, the website that lets you view browser support for browser features.  When people criticize my blog posts for not detailing browser support for features within the post, I tell them to check CanIUse:  always up to date, unlike...

  • Generating Alternative Stylesheets for Browsers Without @media

    If your CSS code is built with a mobile-first approach, it probably contains all the rules that make up the "desktop" view inside @media statements. That's great, but browsers that don't support media queries (IE 8 and below) will simply ignore them, ending up getting the...

  • Serve a Directory with PHP

    Many developers have a giggle at PHP, even looking down at the language, but let's be honest:  most of our blogs are powered by it (WordPress) and it's a great language to dabble around with.  I cut my teeth on PHP, though I prefer to avoid PHP these days. But...