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

3 thoughts on “Setting MacOS Dock Icons using Jumpcloud Commands”

  1. Cannot get this to work. zsh: /opt/homebrew/bin/dockutil: bad interpreter: /usr/bin/python: no such file or directory

    Many others with the same problem and can’t seem to resolve.

    Reply
    • Hi Ryan
      Please try instead of

      /usr/local/bin/dockutil –add /Applications/Safari.app /Users/$currentuser

      Try

      dockutil –add /Applications/Safari.app /Users/$currentuser

      Let me know if that works. I’m also updating the scritp to grab the latest version.

      Thanks

      Reply
  2. I am looking to get several of the Adobe apps to populate the dock, however, using the form that you have above I get this error.

    Reply

Leave a Comment