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

Recent Features

  • Write Better JavaScript with Promises

    You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...

  • Serving Fonts from CDN

    For maximum performance, we all know we must put our assets on CDN (another domain).  Along with those assets are custom web fonts.  Unfortunately custom web fonts via CDN (or any cross-domain font request) don't work in Firefox or Internet Explorer (correctly so, by spec) though...

Incredible Demos

  • MooTools HTML Police: dwMarkupMarine

    We've all inherited rubbish websites from webmasters that couldn't master valid HTML. You know the horrid markup: paragraph tags with align attributes and body tags with background attributes. It's almost a sin what they do. That's where dwMarkupMarine comes in....

  • jQuery Link Nudging

    A few weeks back I wrote an article about MooTools Link Nudging, which is essentially a classy, subtle link animation achieved by adding left padding on mouseover and removing it on mouseout. Here's how to do it using jQuery: The jQuery JavaScript It's important to keep...

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

  • OSCON Portland:  Conference  Discount!

    O'Reilly puts on the best web industry conferences in the world.  These conferences include Fluent Conference, Velocity Conference, and the upcoming OSCON in Portland, Oregon from July 20-24.  Open Source Convention (OSCON) is a conference that focuses specifically on open source developers and the tools and possibilities...

  • Follow Redirects with cURL

    I love playing around with cURL. There's something about loading websites via command line that makes me feel like some type of smug hacker, just like tweeting from command line does. I recently cURL'd the Google homepage and saw the following: I found it weird that Google...

  • Developers Have WordPress, Amateurs Have Squarespace, Professional Designers Have the NEW Webydo!

    Web design platforms have traditionally come in one of two varieties. There are the solutions like WordPress and Drupal that are incredibly powerful, but an understanding of web development and coding is required to be able to use those platforms effectively. On the other side of the...

  • Chris Coyierâs Favorite CodePen Demos II

    Hey everyone! Before we get started, I just want to say it’s damn hard to pick this few favorites on CodePen. Not because, as a co-founder of CodePen, I feel like a dad picking which kid he likes best (RUDE). But because there is just so...

  • GSAP + SVG For Power Users: Motion Along A Path

    Now that the GreenSock API is picking up steam, there are many tutorials and Getting Started guides out there to provide good introductions to the library, not to mention GreenSock’s own Forum and Documentation. This article isn’t intended for beginners, but rather a...