Dockutil Doesn't Remove Some Apps

Morningside
Contributor II

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
4 REPLIES 4

Hugonaut
Valued Contributor II

I posted this here as well - https://www.jamf.com/jamf-nation/discussions/28294/dockutil-cannot-get-rid-of-siri-ibooks-or-maps

Heres my script that works fine.

#!/bin/bash

DOCKUTIL_BINARY="/Path/To/dockutil"

# Removal of Apple Default Dock Applications
#########################################################################################

$DOCKUTIL_BINARY --remove 'Siri' --allhomes

$DOCKUTIL_BINARY --remove 'Launchpad' --allhomes

$DOCKUTIL_BINARY --remove 'Safari' --allhomes

$DOCKUTIL_BINARY --remove 'Mail' --allhomes

$DOCKUTIL_BINARY --remove 'Contacts' --allhomes

$DOCKUTIL_BINARY --remove 'Calendar' --allhomes

$DOCKUTIL_BINARY --remove 'Notes' --allhomes

$DOCKUTIL_BINARY --remove 'Reminders' --allhomes

$DOCKUTIL_BINARY --remove 'Maps' --allhomes

$DOCKUTIL_BINARY --remove 'Photos' --allhomes

$DOCKUTIL_BINARY --remove 'Messages' --allhomes

$DOCKUTIL_BINARY --remove 'FaceTime' --allhomes

$DOCKUTIL_BINARY --remove 'iTunes' --allhomes

$DOCKUTIL_BINARY --remove 'iBooks' --allhomes

$DOCKUTIL_BINARY --remove 'App Store' --allhomes

$DOCKUTIL_BINARY --remove 'News' --allhomes
________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

steve_summers
Contributor III

I tried, and tried....and tried...to get DockUtil to work and just frankly couldn't get it to do what I wanted, in the manner I wanted it to. So, someone in Slack posted a link to something called, DockMaster.

http://techion.com.au/blog/2015/4/28/dock-master

I tried it out and it just worked perfectly. You configure everything as you want it to appear on the webpage, then you can download a configuration profile that is a package. Wrap that little guy up and it works.

Maybe that is worth something..? I hope so.

Morningside
Contributor II

I also tried Dock Master but ran into the same problem. Siri & Co. keep on showing up uninvited.

taugust04
Valued Contributor

Could this be your problem?

https://support.apple.com/en-us/HT207568