Quickly lock and unlock the icons in your Dock

I often drag files to folders in my dock. If you've done this you probably already know why it's frustrating: if you don't drag the file to just the right spot, the folder will slide out of the way. If you're actually trying to add the file directly to the dock, that's pretty useful, but otherwise it can be pretty frustrating.

The Dock has a little-known secret though: you can lock it. Here's the secret command you can enter in Terminal:
defaults write com.apple.dock contents-immutable -bool true; killall Dock;

This is easy enough to do, and you can change true back to false if you want to unlock it. If you're like me, you're probably not going to remember this next time you need though. So I made a quick script to handle the whole process for me. You can just drop it in your Applications folder or the script menu. (To enable the script menu in Snow Leopard, open AppleScript Editor, open the Preferences, and check "Show script menu in the menu bar". In earlier versions of OS X, you can do this in AppleScript Utility.)

April 1st, 2010: The first version posted wouldn't work the first time you used the lock feature, which is clearly a problem. It's fixed now.
November 26th, 2013: The script has been updated with support for OS X Mavericks and other recent versions of OS X.

Download this AppleScript Application


This entry has 3 comments.


Ben wrote on March 31, 2010:

Or you could just hold Command while dragging to prevent the Dock from opening a space for the file.


Oscar wrote on April 1, 2010:

Great script (and nice tip, Ben)!


Rob wrote on April 2, 2010:

I had the old "Dock Lock" installed when I was running Leopard. When I moved to "Snow Leopard" the old "Dock Lock" keeps asking for Leopard —- is there a way around this?

Nothing to date seems to work..


View more

Mac OS X

Improved iCloud syncing in our apps We've completely redone iCloud syncing in our apps to make it faster and more reliable…

App Santa: award-winning apps, up to 80% off for Christmas Junecloud has once again joined with several other independent developers for App…

Compatibility with OS X Yosemite OS X Yosemite will be available in the fall, and I'm sure many of you already have a…

A sale, some updates, and future updates Our apps are updated and on sale Delivery Status for iOS, Notefile for iOS, and…