Dockutil not working in Sonoma 14.1

vinu_thankachan
Contributor
 
We are using dockutil to reset the dock. But it stop working on Sonoma 14.1 
Is anyone else facing the issue ?
Sharing the script we use 
 
 
#!/bin/zsh
while ! pgrep -x Dock; do
sleep 1
done
##
 
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
currentUserID=$(/usr/bin/id -u ${currentUser})
currentUserPath="$(dscl . -read /Users/${currentUser} NFSHomeDirectory | awk -F ': ' '{print $2}')"
currentUserDockPath="${currentUserPath}/Library/Preferences/com.apple.dock.plist"
 
until [[ -e "${currentUserPath}/Library/Preferences/com.apple.dock.plist" ]]; do
    echo "waiting for default dock.plist before making customizations"
    sleep 1
done
 
/usr/local/bin/dockutil --remove all --restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/System/Applications/Launchpad.app" --position beginning --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/System/Applications/App Store.app" --after "/System/Applications/Launchpad.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/System/Applications/System Settings.app" --after "/System/Applications/App Store.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft Edge.app" --after "/System/Applications/System Settings.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft Outlook.app" --after "/Applications/Microsoft Edge.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft Teams.app" --after "/Applications/Microsoft Outlook.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft Excel.app" --after "/Applications/Microsoft Teams.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft Word.app" --after "/Applications/Microsoft Excel.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Microsoft PowerPoint.app" --after "/Applications/Microsoft Word.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Connect Tunnel.app" --after "/Applications/Microsoft PowerPoint.app" --no-restart "${currentUserDockPath}"
3 REPLIES 3

Mauricio
Contributor III

Hello, restored an Apple Silicon with 14.1 (23B74) and dockutil version 3.0.2, all working as expected here.

SCCM
Contributor III

What's not working, and how are you applying it? i did some testing on 14.0 recently, and dockutil working during enrolment. But if you ran it when a user was logged in nothing happened. The command was running however the dock was not refreshing adding "Killall Dock" and the end of the commands got around it. If your using it with a user logged in try adding it to the end i.e. 

/usr/local/bin/dockutil --add "/Applications/Microsoft PowerPoint.app" --after "/Applications/Microsoft Word.app" --no-restart "${currentUserDockPath}"
/usr/local/bin/dockutil --add "/Applications/Connect Tunnel.app" --after "/Applications/Microsoft PowerPoint.app" --no-restart "${currentUserDockPath}"
Killall Dock


vinu_thankachan
Contributor

Hi All 
Thanks for the updates and response 
I was able to fix the issue by running docktil and the current user 

 

runAsUser /usr/local/bin/dockutil --add "/Applications/Microsoft PowerPoint.app" --after "/Applications/Microsoft Word.app" --no-restart "${currentUserDockPath}"