Setting MacOS Dock Icons using Jumpcloud Commands

Reading Time: 2 minute read.

Setting MacOS Dock Icons using Jumpcloud Commands

The third part of this series of posts regarding JumpCloud commands. Is setting MacOS Dock Icons using Jumpcloud Commands. This is to ease some of the pain from the onboarding process of new machines/users and standardising the setup.

This is is actually two separate commands (Buy one, get one free 😉 )  One to install DockUtils and the second one to set the MacOS Dock Icons that you wish. I recommend the first command is run when you are setting the machine up and the second command needs to be run once the user whose machine it will be is logged in.

So the first installer command is:

# Script to download, Silent Install and then clean up once installed DockUtil
# Writen by twitter.com/richhickson
# www.RichardHickson.com

#Make temp folder for downloads.
mkdir "/tmp/dockutil/";
cd "/tmp/dockutil/";

#Download DockUtils from GitHub.
curl -L -o /tmp/dockutil/dockutil.pkg "https://github.com/kcrawford/dockutil/releases/download/2.0.5/dockutil-2.0.5.pkg";

#install DockUtils
sudo installer -pkg  /private/tmp/dockutil/dockutil.pkg -target /;

#tidy up
sudo rm -rf "/tmp/dockutil";

exit 0

Then the second commands are any you like from here. As an example I have the ones I have written below.

# Script to download, Silent Install and then clean up once installed DockUtil
# Writen by twitter.com/richhickson
# www.RichardHickson.com


#Define Current User
currentuser=$(ls -l /dev/console | awk '{ print $3 }')

#Remove All Icons
/usr/local/bin/dockutil --remove all /Users/$currentuser

#Set Icons
/usr/local/bin/dockutil --add /Applications/Safari.app /Users/$currentuser
/usr/local/bin/dockutil --add /Applications/TextEdit.app /Users/$currentuser
/usr/local/bin/dockutil --add "/Applications/Microsoft Word.app" /Users/$currentuser
/usr/local/bin/dockutil --add "/Applications/Microsoft Excel.app" /Users/$currentuser
/usr/local/bin/dockutil --add "/Applications/Microsoft PowerPoint.app" /Users/$currentuser
/usr/local/bin/dockutil --add "/Applications/Firefox.app" /Users/$currentuser
/usr/local/bin/dockutil --add "/Applications/Google Chrome.app" /Users/$currentuser

I decided to only apply the icons to the logged-in user but you could use –allhomes in place of /Users/$currentuser which would apply it to every user on the machine.

If there are any other applications, you will find useful please leave me a comment below or on twitter @richhickson

Leave a Comment