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

  • Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() – this is the hook that allows Javascript code to synchronize with a web browser's native paint loop. Animations using this method can run at 60 fps and deliver fantastic...

  • Vibration API

    Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user.  One of those simple APIs the Vibration API.  The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...

Incredible Demos

  • “Top” Watermark Using MooTools

    Whenever you have a long page worth of content, you generally want to add a "top" anchor link at the bottom of the page so that your user doesn't have to scroll forever to get to the top. The only problem with this method is...

  • Create a Clearable TextBox with the Dojo Toolkit

    Usability is a key feature when creating user interfaces;  it's all in the details.  I was recently using my iPhone and it dawned on my how awesome the "x" icon is in its input elements.  No holding the delete key down.  No pressing it a...

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

  • Prevent Chrome from Translating a Page

    A while back I shared my favorite Google Chrome extension:  Google Art Project.  I've enjoyed seeing beautiful art when I open a new tab -- it's brought genuine happiness to my day, however small that happiness may be.  About a week ago, however, the art presented had...

  • Create Any Type Of Website With These Multi-Purpose Themes

    We have selected what we believe are the very best multipurpose WordPress themes on the market today. Our list contains a number of best sellers, several newcomers that are proving to be highly popular, and a few themes that are ideal for creating the types of...

  • An Introduction to Static Site Generators

    Static site generators seem to have been becoming more and more popular recently, but they’re not one of those ephemeral novelty things that grow in popularity as quickly as they fall into oblivion shortly after. For over a decade, many different projects — 394 of...

  • Automated Tests for Visual Responsive Layouts

    Today it's all about testing. In 2015, many developers knows about TDD and I personally think that testing is one of the key for quality products. But what about testing in a Front-end environment? How do you guys write your tests for a responsive page or...

  • Getting Dicey With Flexbox

    What if you could build complex CSS layouts in minutes? Flexbox is a new CSS layout spec that makes it easy to construct dynamic layouts. With flexbox, vertical centering, same-height columns, reordering, and direction agnosticism are a piece of cake. There's a popular myth floating around that...