I have been using dockutil for years without issue. I have historically been putting the shell script in the Users/Shared/bin folder and the plist in the user LaunchAgent folder. Like I said, years have been working...
Now that Python is not installed by default and using the newest version of Dockutil, I cannot get it to run. I have tried to get this to run via Jamf. I have used Jamf to dump the two files into their respective homes on the endpoint. Heck, I have even manually added the files to a target computer just for testing. All I get is an "unable to execute (path to .sh file) Operation not permitted. I don't know what I am doing wrong, but it's making my hair fall out.
Here are my scripts...
#!/bin/zsh
dockutilbin=$(/usr/local/bin/dockutil)
loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name
&& ! /loginwindow/ { print $3 }' )
loggedInUserPlist="/Users/$loggedInUser/Library/Preferences/com.apple.dock.plist"
$dockutilbin --remove all --no-restart $loggedInUserPlist; sleep 2
$dockutilbin --add file:///System/Applications/Launchpad.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Safari.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Google\\ Chrome.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Bridge\\ 2022/Adobe\\ Bridge\\ 2022.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Photoshop\\ 2022/Adobe\\ Photoshop\\ 2022.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Lightroom\\ Classic/Adobe\\ Lightroom\\ Classic.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Illustrator\\ 2022/Adobe\\ Illustrator.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Premiere\\ Pro\\ 2022/Adobe\\ Premiere\\ Pro\\ 2022.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Substance\\ 3D\\ Designer/Adobe\\ Substance\\ 3D\\ Designer.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Adobe\\ Substance\\ 3D\\ Painter/Adobe\\ Substance\\ 3D\\ Painter.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Autodesk/maya2023/Maya.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/TVPaint\\ Animation\\ 11.5\\ Pro.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/Corel\\ Painter\\ 2021/Corel\\ Painter\\ 2021.app/ --no-restart $loggedInUserPlist
$dockutilbin --add file:///Applications/VLC.app/ --no-restart $loggedInUserPlist
$dockutilbin --add '/Applications/' --view grid --display folder --sort name --no-restart $loggedInUserPlist
$dockutilbin --add '~/Downloads/' --view fan --display folder --sort name $loggedInUserPlist
exit 0
defaults write com.apple.dock tilesize -int 40
defaults write com.apple.dock magnification -bool true
exit 0
Here is the plist that should be triggering everything...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>TEST</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Shared/bin/test.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
I will say that only one time did the dock update to include the items listed in the script above. It just added them to the default list that populates the dock out of the box. I have never been able to reproduce it.
What am I missing?
Ultimately I would love to have this script run from Jamf so I don't have to use the script and plist files on the computer. Docutil is installed on every computer I manage...
Before Monterey, this is the script that worked... It worked a treat too. Dock would show up for a second with just the trash can, blink off, then blink back on as requested with the settings and everything.
#!/bin/bash
# Running checkSetupDone function to determine if the rest of this script needs to run.
# Yes, if $HOME/Library/Preferences/com.ARC.docksetup.plist file does not exist.
# Otherwise, assume this setup script has already run for this user and does not
# need to run again.
checkSetupDone() {
if [ -f $HOME/Library/Preferences/com.ARC.docksetup.plist ] ; then
exit 0
fi
}
configureDefaultDock() {
DOCKUTIL=/usr/local/bin/dockutil
$DOCKUTIL --remove all --no-restart
$DOCKUTIL --add '/System/Applications/Launchpad.app' --no-restart
$DOCKUTIL --add '/Applications/Safari.app' --no-restart
$DOCKUTIL --add '/Applications/Google Chrome.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Bridge 2022/Adobe Bridge 2022.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Photoshop 2022/Adobe Photoshop 2022.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Lightroom Classic/Adobe Lightroom Classic.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Illustrator 2022/Adobe Illustrator.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Premiere Pro 2022/Adobe Premiere Pro 2022.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Substance 3D Designer/Adobe Substance 3D Designer.app' --no-restart
$DOCKUTIL --add '/Applications/Adobe Substance 3D Painter/Adobe Substance 3D Painter.app' --no-restart
$DOCKUTIL --add '/Applications/Autodesk/maya2023/Maya.app' --no-restart
$DOCKUTIL --add '/Applications/TVPaint Animation 11.5 Pro.app' --no-restart
$DOCKUTIL --add '/Applications/Corel Painter 2021/Corel Painter 2021.app' --no-restart
$DOCKUTIL --add '/Applications/VLC.app' --no-restart
$DOCKUTIL --add '/Applications' --view grid --display folder --sort name
touch $HOME/Library/Preferences/com.ARC.docksetup.plist
}
checkSetupDone
configureDefaultDock
defaults write com.apple.dock tilesize -int 40
defaults write com.apple.dock magnification -bool true
exit 0