Manage User Docks from the Terminal

When managing school machines there are a lot of times were you want to have a certain set of apps in the Dock on a Mac. For example you have may have a cart of MacBooks that are used as a mobile lab that should all look the same to the user.

You might be surprised how many people think there might be something wrong with the Mac because it doesn’t have the same Dock as the one they used previously. Also kids will be kids and like to mess around.

Enter dockutil (Installer Pkg), a command line utility written in Python. The installer puts the utility in the /usr/local/bin directory, which is already in your path environment. After install open up the terminal and run:

What’s going on here?!?

The $DOCKUTIL --remove all removes everything in the Dock which you might have guessed. $DOCKUTIL --add '/Applications/Google Chrome.app adds the Google Chrome web browser, but the added --no-restart doesn’t restart the Dock meaning we have more to do. The default action is to restart the Dock after you make a change, by passing in the --no-restart it surpresses the OSes urge to restart it. Note that the of the script we ad the Downloads folder as dockutil is able to differentiate the difference of an app and a folder.

Hopefully the dockutil becomes a good utility for you to manage a users Dock.