Closed kiepenflicker closed 2 years ago
Was this working in the old python version?
Yes, it was. I retested it with 2.0.5 on 12.2.1. and the --allhomes parameter in a root session
After that I undocked all Apps, Installed 3.0.0 beta 2, rebooted and ran the same commands again. One time with a script in a Jamf policy, the other time in a root session from the Terminal. The result is that the com.apple.dock.plists for all users are populated and the Dock restarted, but no Apps are docked. After killall cfprefsd and killall Dock the Dock showed the apps. Adding other apps so that they appear after dockutil has restarted the Dock works after killall cfprefsd was executed.
I found 2 issues that will be resolved in the next version. They might address the issues you are seeing.
I'm still a little unclear on how to reproduce the issues if you could give me step by step instructions with exact dockutil commands and how it was run. I'd like to make sure I have the issues fixed if possible.
Also, does running it with --no-restart and then killall -9 Dock workaround the issue (without killing cfprefsd)? Does running the same dockutil command twice workaround the issue?
My workflow regarding dockutil and dock configuration is the following.
Environment:
Types of dockutil use:
Further information:
The launchagent contains the following commands or noteworthy actions. It runs in the user context with the parameter RunAtLoad true
a while loop, that checks if the com.apple.dock.plist exists for the current user and continues when it does.
a while loop, that checks if Dock.app is running and continues when it does.
"/usr/local/bin/dockutil" --remove 'App Store' --no-restart
... the same command with some other default Apple apps
"/usr/local/bin/dockutil" --add '/Applications/Self Service.app' --after "Launchpad"
killall cfprefsd
sleep 2
killall Dock
sleep 2 If I don't add the two killall commands, the dock wont't be configured on some machines. I can't see a pattern that could cause this behaviour. It runs very stable that way.
Steps to reproduce the problem I reported:
The Script is no rocket science. It is executed the following way
sudo script.sh "" "" "" "add" "/Applications/Microsoft Edge.app" "after" "Mission Control"
#!/bin/bash
set -x
DOCKUTIL="/usr/local/bin/dockutil"
if [[ ! -f "$DOCKUTIL" ]]; then
echo "$DOCKUTIL does not exist. Bailing out here..."
exit 0
fi
# $4 add/remove
# $5 path/name
# $6 (optional) before/after
# $7 (optional) item for before/after
if [[ "${6}" != "" ]]; then
EXTRAPARAM="--$6"
else
EXTRAPARAM=""
fi
if [ -d "$5" ]; then
"$DOCKUTIL" --$4 "$5" $EXTRAPARAM "$7" --allhomes
sleep 1
else
echo "$5 not found. Could not dock the app."
fi
@kcrawford Not sure if this is the same issue or something else. When I ran this script below as root it worked every time on the old non-beta version of dockutil now on the beta it fails to run and doesn't set the dock.
#!/bin/bash echo "running dockutil" DOCKUTIL=/usr/local/bin/dockutil $DOCKUTIL --remove all --no-restart --allhomes apps=( "/System/Applications/Launchpad.app" "/Applications/Google Chrome.app" "/Applications/Microsoft Word.app" "/Applications/Microsoft Excel.app" "/Applications/Microsoft PowerPoint.app" "/Applications/Microsoft Outlook.app" "/Applications/Slack.app" "/Applications/zoom.us.app" "/Applications/Adobe Acrobat Reader DC.app" "/Applications/Box.app" "/Applications/Self Service.app" "/System/Applications/System Preferences.app" ) for app in "${apps[@]}"; do $DOCKUTIL --add "$app" --no-restart --allhomes done killall Dock exit 0
Same result here, if I run it the most of the apps are not showing in docking: Only 3 are in the docking the rest is not showing, the user is an admin. With V2 its working perfect.
dockUtil="/usr/local/bin/dockutil"
echo "Removing all Applications" $dockUtil --remove all --allhomes
$dockUtil --add '/System/Applications/Launchpad.app' --replacing 'Launchpad' --allhomes --no-restart $dockUtil --add '/System/Applications/Preview.app' --replacing 'Preview' --allhomes --no-restart $dockUtil --add '/Applications/Safari.app' --replacing 'Safari'--allhomes --no-restart $dockUtil --add '/Applications/Microsoft Edge.app' --replacing 'Microsoft Edge' --allhomes --no-restart $dockUtil --add '/System/Applications/Notes.app' --replacing 'Notes' --allhomes --no-restart $dockUtil --add '/System/Applications/Contacts.app' --replacing 'Contacts' --allhomes --no-restart $dockUtil --add '/System/Applications/Calendar.app' --replacing 'Calendar' --allhomes --no-restart $dockUtil --add '/System/Applications/App Store.app' --replacing 'App Store' --allhomes --no-restart $dockUtil --add '/Applications/Microsoft Word.app' --replacing 'Microsoft Word' --allhomes --no-restart $dockUtil --add '/Applications/Microsoft PowerPoint.app' --replacing 'Microsoft PowerPoint' --allhomes --no-restart $dockUtil --add '/Applications/Microsoft Outlook.app' --replacing 'Microsoft Outlook' --allhomes --no-restart $dockUtil --add '/Applications/Microsoft Excel.app' --replacing 'Microsoft Excel' --allhomes --no-restart $dockUtil --add '/Applications/Microsoft Teams.app' --replacing 'Microsoft Teams' --allhomes --no-restart $dockUtil --add '/System/Applications/System Preferences.app' --replacing 'System Preferences' --allhomes --no-restart $dockUtil --add '/Applications/Self Service.app' --replacing 'Self Service' --allhomes
Thanks. I will investigate.
I think I have this fixed. New release soon.
Thanks all for reporting and providing details on this issue. Please test in 3.0 beta 3.
The issue is gone in the Beta 3 for my workflows. :-) I have tested it on 12.2.1 and 12.3 Beta on Intel and Apple Silicon. Thank you!
Awesome. Glad this is working now. Thanks for all the testing and background. Closing this issue!
Thanks for the Beta 2. :-) I encountered two --allhomes not working scenarios when testing it with the 12.3 Beta (21E5212f).
Scenario 1:
When I enroll a mac, log in the first user for the first time and use dockutil with the parameter --allhomes as root via sudo, the app I want to dock is written to all homes /Library/Preferences/com.apple.dock.plist but the app does not appear in the Dock after the Dock restarts. I need to do a killall cfprefsd and killall Dock to make the app appear in the Dock. After that everything behaves normally.
Scenario 2:
I am logged in as User1, Execute dockutil as root with --allhomes. The app appears in the com.apple.dock.plist of every user that has this file / was logged in at least once.
I log out User1 and login as User2
The app is not docked and the entry in com.apple.dock.plist of User2 disappeared.
I log out User2 and login as User1
Execute dockutil as root with --allhomes and do a killall cfprefsd
I log out User1 and login as User2
The app is docked now