Dockutil not working with Mojave

j_grafton
New Contributor III

Hi,
I use dockutil to set up the dock for each user on their Mac to have a few web browsers, Microsoft office and their home folders. It also removes stuff like FaceTime and messages and mail app. This works great on high Sierra but I’ve noticed if I upgrade a iMac to Mojave from high Sierra using normal Apple installer dockutil still works on Mojave but if I wipe the Mac and install Mojave fresh the dock util policy says it worked but the dock is just the standard Apple dock and still has face time and messages and doesn’t have my web browsers and Microsoft office. Any help much appreciated thanks

7 REPLIES 7

j_grafton
New Contributor III

Edit:
On a iMac that had dockutil working in high sierra when I upgrade to Mojave it doesn't work and the dock gets the policy for the settings of the dock but keeps the standard apple settings.

abuehler
New Contributor III

Hey Joe

We successfully use Dockutil in our environment with Mojave and Catalina.
Below is an example of a Dockutil-Script that works perfectly fine for us under Mojave:

#!/bin/bash

# This script creates a Dock using 'diskutil'

    currentuser=$(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 + "
");')
    dockutil="/usr/local/bin/dockutil"


    # Remove all

    su -l "${currentuser}" -c "${dockutil} --remove all --no-restart"

    sleep 5

    # Add applications

    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Safari.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Microsoft Word.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Microsoft Excel.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Microsoft PowerPoint.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Microsoft Outlook.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Cisco Jabber.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Notes.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/System Preferences.app' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Self Service' --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '/Applications/Utilities/Keychain Access.app' --no-restart"

    # Add folders

    su -l "${currentuser}" -c "${dockutil} --add '/Applications' --view grid --display folder --no-restart"
    su -l "${currentuser}" -c "${dockutil} --add '~/Downloads' --view grid --display folder --no-restart"

    # Kill dock

    su -l "${currentuser}" -c "killall Dock"

exit 0      ## Success
exit 1      ## Failure

maurits
Contributor

We use dockutil too, mind the difference between 10.14 and 10.15 for system apps:

10.14: /Applications/System Preferences.app
10.15: /System/Applications/System Preferences.app

larry_barrett
Valued Contributor

There's a few more:
Launchpad - file://Macintosh HD/System/Applications/Launchpad.app
Facetime - file://Macintosh HD/System/Applications/FaceTime.app

TV app is new. - file://Macintosh HD/System/Applications/Tv.app
Podcasts app is new. - file://Macintosh HD/System/Applications/Podcasts.app
Music app is new - file://Macintosh HD/System/Applications/Music.app

I'm probably missing a couple.

robertojok
Contributor

I have used Error Free IT/Dockmaster for a while now and it seems to work without any issues
https://github.com/Error-freeIT/Dock-Master

paul_cruz
New Contributor

Here is my script that i used

https://github.com/TheNite/Jamf-Scripts/blob/master/dock.sh

#!/bin/bash

# Configure the dock for a new user
# Script to to be use during the splash buddy setup on jamf
# This will also allow new hires to remove any of the default apps if they wish so.
# This script assumes the brew package "Dockutil" is installed as per the enrollment of the computer
# Run this Script with splashbuddy

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Arrays of Apps
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Apps that are installed in the '/Applications/' directory
Apps=("Firefox.app" "Slack.app" "Sublime Text.app" "1Password 7.app" "Messages.app" "Github Desktop.app" "PostMan.app" "xcode.app" "App store.app")

#Default systems that are installed in the '/Applications/Utitlies/' directory
system_utilities_apps=("Terminal.app")

#System defautl apps that are installed in the '/Applications/' OR for Catalina in '/System/Applications/' directory
system_default_apps=("System Preferences.app")

#Folders to add to the dock
user_folders=("Downloads")

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Variables
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 macos_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')

dockutil=/usr/local/bin/dockutil
sleepTime=2

#FolderLocations
appFolder="/Applications"
utilAppFolder="$appFolder/Utilities"

#Remove all current dock items
$dockutil --remove all --no-restart --allhomes

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Add apps to docks
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

function dockutil_catalina {
    for app in "${Apps[@]}"; do
        echo ${app}
        $dockutil --add "$appFolder/${app}" --no-restart --allhomes
    done

    for app in "${system_default_apps[@]}"; do
        echo ${app}
        $dockutil --add "/System/Applications/${app}" --no-restart --allhomes
    done

    for app in "${system_utilities_apps[@]}"; do
        echo ${app}
        $dockutil --add "/System/$utilAppFolder/${app}" --no-restart --allhomes
    done

    for folder in "${userFolders[@]}"; do
        $dockutil --add "~/${folder}" --no-restart --allhomes
    done
}

function dockutil_all() {
    for app in "${Apps[@]}"; do
        echo ${app}
        $dockutil --add "$appFolder/${app}" --no-restart --allhomes
    done

    for app in "${system_utilities_apps[@]}"; do
        $dockutil --add "$utilAppFolder/${app}" --no-restart --allhomes
    done

    for folder in "${userFolders[@]}"; do
        $dockutil --add "~/${folder}" --no-restart --allhomes
    done
}


if [[ "$macos_vers" -ge 15 ]]; then
    dockutil_catalina
else
    dockutil_all
fi

defaults write com.apple.dock show-recents -bool FALSE

# Cleanup

sleep $sleepTime

/usr/bin/killall Dock >/dev/null 2>&1

exit 0

emclean
New Contributor II

Hi. Can someone help me with modify a scrip for 10.15 to only include the following on the dock under a local administrator account:

Chrome, Terminal, Activity Monitor, Console, Disk Utility, Sublime Text, Batchmod, and settings