Sadly, Mac OS X doesn’t let you lock the dock straightforwardly. There is no openly laid out option to lock the dock once you’ve set it up the way you want it to. But it is there deep in your system preferences. It’s just a matter of turning this capability on or off. And this can be achieved in different ways.
If you’re familiar with using Terminal and typing up a bunch of codes to tweak some behavior of Mac OS X, then this is the method for you.
Open up terminal and type the following code:
- defaults write com.apple.dock contents-immutable -bool true
- killall Dock
When you hit enter, you may be required to enter your system password. Setting the boolean to true will lock the dock. Of course from time to time you may want to add or remove items from the dock. Doing the same approach above and setting the boolean value to false will unlock it.
But if you would prefer interacting with check boxes instead of entering codes, you may opt to using apps like Deeper to satisfy your need to lock the dock. There are many other apps out there that can assist you in doing this, but Deeper should do you fine.

click to enlarge
Simply
download and install Deeper from here and go to the Dock preference page. Simply click on the “Lock the icons” check box and voila, your dock is now locked. Should there be a time when you need to unlock the dock to add or remove items from it, simple run Deeper again, uncheck “Lock the icons”, and you’ll regain the ability to add or remove items from the it, as well resizing it to your liking.