I have the following script that leverages dockutil to manage the logged in user's doc (borrowed from some other thread within this forum). I have noticed, however, that --remove-all does not remove a handful of apps from the dock, including Siri, Maps, Photos, and News. Should I be doing something differently? Relatedly, the option to affect the Default User Template seems to produce the following error:
"/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist."
It seems that the touch command is not working. Is this a known issue with Mojave?
The script:
#!/bin/sh
LoggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
LoggedInUserHome="/Users/$LoggedInUser"
configureDefaultDock() {
echo "Logged in user is $LoggedInUser"
echo "Logged in user's home $LoggedInUserHome"
if [ -e /usr/local/bin/dockutil ];
then
dockutilVersion=`/usr/local/bin/dockutil --version --version`; echo "dockutil version: $dockutilVersion"
echo "Clearing Dock..."; /usr/local/bin/dockutil --remove all --no-restart "$LoggedInUserHome"
echo "Removing Siri..."; /usr/local/bin/dockutil --remove 'Siri' --no-restart "$LoggedInUserHome"
echo "Adding Google Chrome..."; /usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart --position 1 "$LoggedInUserHome"
echo "Adding Downloads..."; /usr/local/bin/dockutil --add '~/Downloads' --no-restart --position 7 "$LoggedInUserHome"
/usr/local/bin/dockutil --remove 'Siri' --no-restart '/System/Library/User Template/English.lproj'
/usr/local/bin/dockutil --add '/Applications/Google Chrome.app' --no-restart --position 1 '/System/Library/User Template/English.lproj'
touch $LoggedInUserHome/Library/Preferences/com.apple.dock.plist
else
echo "dockutil not installed, skipping initial dock setup..."
fi
}
configureDefaultDock
killall -KILL Dock
exit 0