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}"