Open cipineda opened 1 year ago
Tested it here and problem can you share your script
Ok check this script: https://github.com/mvdbent/setDock/blob/main/setDock-defaultDock.sh run it and test it. I am 100% sure that if you incorporate your part in this everything will work properly!
thanks!!!, I really appreciate it; will give it a try.
Hi @mvught, It keeps failing on Sonoma.
sh-3.2# sh /Users/UserA/Desktop/dockItems.sh Dockutil version = 3.0.2 clean-out the Dock adding /Applications/Slack.app /Users/UserA/Desktop/dockItems.sh: line 19: 37174 Trace/BPT trap: 5 launchctl asuser "$uid" sudo -u "${currentUser}" "$@" adding /Applications /Users/UserA/Desktop/dockItems.sh: line 19: 37186 Trace/BPT trap: 5 launchctl asuser "$uid" sudo -u "${currentUser}" "$@" Restarted the Dock Finished creating default Dock
Hi @mvught, It keeps failing on Sonoma.
sh-3.2# sh /Users/UserA/Desktop/dockItems.sh Dockutil version = 3.0.2 clean-out the Dock adding /Applications/Slack.app /Users/UserA/Desktop/dockItems.sh: line 19: 37174 Trace/BPT trap: 5 launchctl asuser "$uid" sudo -u "${currentUser}" "$@" adding /Applications /Users/UserA/Desktop/dockItems.sh: line 19: 37186 Trace/BPT trap: 5 launchctl asuser "$uid" sudo -u "${currentUser}" "$@" Restarted the Dock Finished creating default Dock
I'm also getting this BPT trap which I think is the cause of not getting the dock configured correctly.
Does anyone else face the same issue?
@das197
Try something like this
dockutil="/usr/local/bin/dockutil"
LOGGEDINUSER=$(stat -f '%Su' /dev/console)
uid=$(id -u "${LOGGEDINUSER}")
runAsUser() {
if [[ "${LOGGEDINUSER}" != "loginwindow" ]]; then
launchctl asuser "$uid" sudo -u "${LOGGEDINUSER}" "$@"
else
echo "no user logged in"
exit 1
fi
}
if [ "$LOGGEDINUSER" == "root" ]; then
echo "Currently logged in user is root - aborting."
echo "------------------------------------------------------------"
exit 1
fi
homeDirectory="/Users/$LOGGEDINUSER/"
runAsUser "$dockutil" --add "/Applications/Google Chrome.app" --no-restart "$homeDirectory"
Using the runasUser function helped
Are you able to reproduce the BPT trap error? Did you figure out what is/was causing the error?
Are you able to reproduce the BPT trap error? Did you figure out what is/was causing the error?
yes I reproduced it, no I didn't have a clue what caused it. When I tried to run the dockutil commands as sudo (current user) that didn't help. Eventually I tried Armin's way and it worked flawlessly.
Hello, Started testing Sonoma in my environment and noticed a few issues.
1.- Adding/Removing with the --no-restart seems to have no effect anymore. 2.- Getting this error: Setting Dock for user cesar.sonoma... Error: /var/root/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist Usage: dockutil [] [ ...]
See 'dockutil --help' for more information.
Error: /var/root/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
The script works fine in Ventura, it seems something changed in Sonoma that dockutil does not like.