This thread may help you:
https://www.jamf.com/jamf-nation/discussions/24068/execute-dockutil-script-when-user-logs-in-post-imaging
What problems are you running in to with 10.12? If you wanna post your script, that could be helpful too.
Thanks for the reply. The problem is is that it just doesn't do anything. Casper pushes it with no errors but the script has 0 effect.
#!/bin/sh
##remove plist
sudo rm /Library/Preferences/com.apple.dock.plist
sudo rm ~/Library/Preferences/com.apple.dock.plist
################your line below
sudo /dockutil --remove 'Launchpad' --allhomes
sudo /dockutil --remove 'Mail' --allhomes
sudo /dockutil --remove 'Maps' --allhomes
sudo /dockutil --remove 'FaceTime' --allhomes
sudo /dockutil --remove 'System Preferences' --allhomes
sudo /dockutil --remove 'Photos' --allhomes
sudo /dockutil --remove 'iTunes' --allhomes
sudo /dockutil --remove 'iBooks' --allhomes
sudo /dockutil --remove 'App Store' --allhomes
sudo /dockutil --add /Applications/Firefox.app --after 'Safari' --allhomes
sudo /dockutil --add /Applications/Google Chrome.app --after 'Firefox' --allhomes
sudo /dockutil --add /Applications/Adobe Acrobat Reader DC.app --allhomes
sudo /dockutil --add /Applications/Microsoft Office 2011/Microsoft Word.app --allhomes
sudo /dockutil --add /Applications/Microsoft Office 2011/Microsoft Excel.app --allhomes
sudo /dockutil --add /Applications/Microsoft Office 2011/Microsoft Powerpoint.app --allhomes
sudo /dockutil --add /Applications/Self Service.app --position end --allhomes
sudo /dockutil --remove 'Downloads' --allhomes
sudo /dockutil --add '~/Downloads' --view list --display folder --allhomes
exit 0
Try putting the full path to dockutil or just setting the location to a variable. Kinda like this:
#!/bin/bash
dockutil=/usr/local/bin/dockutil
sleep 20
$dockutil --remove 'Siri' --allhomes
or just
#!/bin/bash
sleep 20
/usr/local/bin/dockutil --remove 'Siri' --allhomes
See if that helps.
Several issues I see.
First, get rid of all thesudos
. Not that that's likely the issue, but they are totally unnecessary when the entire script is running in a root context.
Two, this command rm ~/Library/Preferences/com.apple.dock.plist
is likely not doing what you're expecting, since the ~
isn't going to resolve to the logged in user, but to the account running the script, which would be root.
But the main suggestion I have is one I've made elsewhere regarding dockutil scripts. Put a --no-restart
at the end of each line, except for the last one. I've found that the Dock really does not like being restarted like 20 times in a row, so it's probably just stopping those dock restarts at some point and not reflecting the changes. The --no-restart
's will prevent dockutil from restarting the Dock after each change and only do one restart at the end of the script.
Lastly, is dockutil installed at the root of your hard drive? The /dockutil
path for it you have seems to indicate that. Just wondering if that's correct or not?
Thanks @perrycj and @mm2270 , I tried both of your suggestions and it now works.