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 wrote on April 1, 2010:

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

Oscar

Oscar wrote on April 1, 2010:

Great script (and nice tip, Ben)!

Rob

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

R

View more

Mac

The Future of Deliveries Deliveries began as a hobby—it was first released as a Dashboard widget named “Apple…

An update on our apps It’s been a while since we shared an update on everything we’re working on. With iOS 15…

Upcoming changes to Deliveries Deliveries 9.2 will be available soon, and we wanted to let you know about some changes…

Deliveries 9 will arrive September 30 Deliveries 9 will be available this Wednesday, September 30, for iPhone, iPad, Apple…