Thursday - last edited Thursday
Hey folks,
I have a weird one. We use dockutil to manage Dock.
Dockutil installation + sorting out the Dock is set as a policy after enrollment.
Policy deploys fine, installs Dockutil, adds the required icons but doesn't remove any of them with error 'Remove failed for xxx in /User/Username/Library/Preferences/com.apple.dock.plist'. Although, same script is added to our SelfService and when its run from there, it works as a charm.
#!/bin/bash
echo "running dockutil"
DOCKUTIL=/usr/local/bin/dockutil
$DOCKUTIL --remove 'Safari' --allhomes
$DOCKUTIL --remove 'Mail' --allhomes
$DOCKUTIL --remove 'Contacts' --allhomes
$DOCKUTIL --remove 'Calendar' --allhomes
$DOCKUTIL --remove 'Photos' --allhomes
$DOCKUTIL --remove 'Messages' --allhomes
$DOCKUTIL --remove 'FaceTime' --allhomes
$DOCKUTIL --remove 'iTunes' --allhomes
$DOCKUTIL --remove 'iBooks' --allhomes
$DOCKUTIL --remove 'Maps' --allhomes
$DOCKUTIL --remove 'TV' --allhomes
$DOCKUTIL --remove 'Music' --allhomes
$DOCKUTIL --remove 'Podcasts' --allhomes
$DOCKUTIL --remove 'Freeform' --allhomes
$DOCKUTIL --remove 'App Store' --allhomes
apps=(
"/Applications/Slack.app"
"/Applications/1Password.app"
"/Applications/Quip.app"
"/Applications/Clockify Desktop.app"
"/Applications/Self Service.app"
"/Applications/Privileges.app"
)
for app in "${apps[@]}"; do
$DOCKUTIL --add "$app" --no-restart --allhomes
sleep 2
done
killall Dock
exit 0
Any idea what could be the problem here?
Thanks a lot.
Solved! Go to Solution.
Thursday
I had a similar issue and fixed it by just using
$DOCKUTIL --removal all --allhomes
and then adding back what I want, instead of trying to remove everything individually. I suspect it has to do with loading the dock for each removal, so you could also try adding --no-restart to the removals as you have done with the adds.
Thursday
If I’m not mistaken when it’s run from SS JAMF is running the script as the user or targeting the user. As far as running it on a device with a logged in user try adding a function to identify the current logged in user. Keep in mind it will fail if no user is logged on as there is no dock to target
Thursday
I had a similar issue and fixed it by just using
$DOCKUTIL --removal all --allhomes
and then adding back what I want, instead of trying to remove everything individually. I suspect it has to do with loading the dock for each removal, so you could also try adding --no-restart to the removals as you have done with the adds.
Thursday
Thank you @TrentO!
Adding --no-restart to each line has resolved the issue.