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

Comments

This entry has 3 comments.

Ben

Ben

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

Oscar

Oscar

Great script (and nice tip, Ben)!

Rob

Rob

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..

R

View more

Mac OS X

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…

Compatibility with OS X Mavericks OS X Mavericks is now available so you might be wondering if our software will work…

Notefile: on the Mac App Store, iCloud, and more Now available on the Mac App Store Dashboard is great for simple widgets like Notefile…

Our Mac software, Mountain Lion, and the Retina Display OS X Mountain Lion is now available, and the MacBook Pro with Retina Display has been out…