How to Lock the Dock Size, Position, and Contents in OS X

We recently discussed how you could quickly reposition the Dock in OS X, but some users are actually interested in the opposite: they want to lock the Dock down, so that children, guests, or other restricted users are prevented from making changes to its position, size, or contents. While there are no end-user options in the OS X interface to set these limitations, you probably won't be surprised to learn that these types of restrictions can be easily enabled with a few Terminal commands.

Lock the Dock Position

As the antithesis of our earlier tip, you can prevent changes to the position of the OS X Dock by running the following Terminal command:

defaults write position-immutable -bool yes; killall Dock

The first part of the command above prevents the user from changing the position of the Dock from its current position on the screen, so be sure you set the Dock to your desired location on the left, right, or bottom of the screen before running it. The second part of the command -- killall Dock -- resets the Dock so that the change will take effect, and it's necessary for enabling or disabling any of the commands discussed here.

os x lock dock position size

After this command is enabled, the options for changing the Dock's position in System Preferences > Dock will be grayed out, and the "Position" submenu in the Dock's context menu will be gone.

Lock the Dock Size

The next step to locking down the Dock in OS X is to prevent changes to its size. To do so, run the following Terminal command:

defaults write size-immutable -bool yes; killall Dock

After executing this command, the user will no longer be able to resize the Dock by clicking and dragging on the dividing line, or via the Size slider in System Preferences.

Again, this command will lock the Dock at its current size, so make sure you set the desired size before running it.

Lock the Dock Contents

Preventing changes to apps and folders listed in the Dock is perhaps the most important reason that users might want to lock it. Note that this doesn't prevent applications that are not in the Dock from being launched (a user can still launch apps via Finder or Spotlight, and those apps will have their icons appear in the Dock while running), it simply prevents a user from changing which apps and folders are "pinned" to the Dock and their position relative to each other.

To lock the Dock contents, run this command:

defaults write contents-immutable -bool yes; killall Dock

You'll now notice that you can't rearrange the position of apps on the Dock, add new apps by dragging them to the Dock from Finder, or use the right-click "Keep in Dock" option on a running application. You also won't be able to remove apps or folders from the Dock.

os x lock dock contents

As with the previous options, this locks the Dock as-is, so make sure that you not only add your desired apps and folders first, but that you also rearrange them if necessary into your preferred order.

Free the Dock!

You can undo any of the changes above by running the corresponding command again and simply changing "yes" to "no." For example, if we've locked everything down but we later decided that we want to let the user change the size of the Dock, we would run:

defaults write size-immutable -bool no; killall Dock

If you're typing commands manually, just remember to add "killall Dock" after each one in order for the change to take effect.

Also note that these are user-level commands, and while they're great for limiting access for young children or inexperienced users, any user with sufficient technical knowledge (or the ability to search Google for this article, for example) will be able to unlock any of the restrictions above. Therefore, it's best not to think of these settings as a security measure but rather as a handy trick that makes managing certain Macs a bit more convenient. Indeed, we've met a few users over the years who used some of these restrictions on their own accounts to prevent accidentally re-sizing the dock or removing certain apps, something that was a bit more common -- and frustrating -- in earlier versions of OS X.