Dockutil issues

CapU
Contributor III

Good Afternoon

I am attempting to use dockutil to place Office2016 icons, and some others on the dock.
I created a .plist and placed in /Library/LaunchAgents, then ran launchctl load path the .plist.
I then created .sh and placed in my scripts location, running chmod on the file. ( I hope this is enough info)
We have a local admin account and 2 domain test accounts plus my normal domain and domain admin account.
For the local account, one test account and my normal domain account the dock shows up with the changes I want, (here is the weird part) but for my admin domain account and the test account account the changes do not appear. I even asked a few others too log in and they do not get the dock.
Does anyone have any ideas as to whats going on?

Thanks in Advance781c7e74e8c345ba8db8210aea1c32fa

1 ACCEPTED SOLUTION

CapU
Contributor III

HA!!
Thanks so much @mm2270 ! Sometimes it takes just takes another perspective. I ran LaunchControl which indicated that I didn't have an interpreter in the script.
I fixed that and it still was showing red. I had to fix the permissions on the script and right in the LaunchControl.app the script went from red to green!!

Thanks all

View solution in original post

5 REPLIES 5

gskibum
Contributor III

Is this the dockutil utility you're referring to?
https://github.com/kcrawford/dockutil

None of the steps you mention sound to me like the process of using dockutil.

CapU
Contributor III

Hi @gskibum

I have copied dockutil to /usr/local/sbin and I reference the location in the script.

mm2270
Legendary Contributor III

Without actually seeing the script or launchd plist, I can't be certain, but It sounds like the script is working only for the current user at login, but then not on additional users who log in. Is that correct?

Have you confirmed the LaunchAgent is correctly loading when the next user logs in? You can see a list of loaded LaunchAgents by doing

launchctl list | grep "<launchd job name>"

It should show up, with a 0 exit code in most cases. If you see any code other than 0 it might mean its erroring. I suggest using something like LaunchControl.app to view the job plist and add some error output into it so you can see if there's a problem.
Also, just to check, is the script it calls in a location that is accessible to all accounts that would log in? Its not within a home directory is it?

CapU
Contributor III

HA!!
Thanks so much @mm2270 ! Sometimes it takes just takes another perspective. I ran LaunchControl which indicated that I didn't have an interpreter in the script.
I fixed that and it still was showing red. I had to fix the permissions on the script and right in the LaunchControl.app the script went from red to green!!

Thanks all

Josh_Smith
Valued Contributor

This is what I use to update the icons...yeah it's a little messy but it works!:

#!/bin/bash

##################
#Script information
##################
#Script: dockutil_Office_2016_Icons
#Purpose: Replaces existing Office 2011 icons with Office 2016 icons for all users



#########
#Variables
#########

SCRIPTNAME="dockutil_Office_2016_Icons"
dockutil="/Library/Application Support/yourfolder/Utilities/dockutil_2.0.2.py"
OUTLOOK2016="/Applications/Microsoft Outlook.app"
WORD2016="/Applications/Microsoft Word.app"
EXCEL2016="/Applications/Microsoft Excel.app"
POWERPOINT2016="/Applications/Microsoft PowerPoint.app"
ONENOTE2016="/Applications/Microsoft OneNote.app"
REMOTEDESKTOP="/Applications/Microsoft Remote Desktop.app"

#########
#SCRIPT
#########

#Remove 2011 icons for all users
"$dockutil" --remove 'Microsoft Outlook' --allhomes --no-restart
"$dockutil" --remove 'Microsoft OneNote' --allhomes --no-restart
"$dockutil" --remove 'Microsoft Word' --allhomes --no-restart
"$dockutil" --remove 'Microsoft Excel' --allhomes --no-restart
"$dockutil" --remove 'Microsoft PowerPoint' --allhomes --no-restart
"$dockutil" --remove 'Microsoft Remote Desktop Connection' --allhomes --no-restart
"$dockutil" --remove 'Microsoft Remote Desktop' --allhomes

sleep 2

#Add 2016 icons for all users
"$dockutil" --add "$REMOTEDESKTOP" --position beginning --allhomes --no-restart
"$dockutil" --add "$ONENOTE2016" --position beginning --allhomes --no-restart
"$dockutil" --add "$POWERPOINT2016" --position beginning --allhomes --no-restart
"$dockutil" --add "$EXCEL2016" --position beginning --allhomes --no-restart
"$dockutil" --add "$WORD2016" --position beginning --allhomes --no-restart
"$dockutil" --add "$OUTLOOK2016" --position beginning --allhomes


#Repeat for User Template - Remove 2011

"$dockutil" --remove 'Microsoft Outlook' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft OneNote' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft Word' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft Excel' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft PowerPoint' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft Remote Desktop Connection' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --remove 'Microsoft Remote Desktop' --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"

#Repeat for User Template - Add 2016


"$dockutil" --add "$REMOTEDESKTOP" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --add "$ONENOTE2016" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --add "$POWERPOINT2016" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --add "$EXCEL2016" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --add "$WORD2016" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"
"$dockutil" --add "$OUTLOOK2016" --position beginning --no-restart "/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist"

exit 0