Posted on 05-12-2017 06:49 AM
Hi all,
I had no issues with dockutil under 10.11 but using the same script with dockutil on 10.12 machines will not work for some reason. Has anyone been successful in using dockutil with Sierra? I tried updating to the latest dockutil but no dice. I can share my dock script if needed. Thanks!
Solved! Go to Solution.
Posted on 05-12-2017 09:17 AM
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.
Posted on 05-12-2017 09:24 AM
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?
Posted on 05-12-2017 09:11 AM
This thread may help you:
What problems are you running in to with 10.12? If you wanna post your script, that could be helpful too.
Posted on 05-12-2017 09:14 AM
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
Posted on 05-12-2017 09:17 AM
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.
Posted on 05-12-2017 09:24 AM
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?
Posted on 05-12-2017 09:55 AM