dockutil icon indicating copy to clipboard operation
dockutil copied to clipboard

dockutil 3.0.2 and Sonoma Beta 23A5276g

Open cipineda opened this issue 1 year ago • 9 comments

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.

cipineda avatar Jun 28 '23 22:06 cipineda

Tested it here and problem can you share your script

mvught avatar Jun 29 '23 12:06 mvught

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!

mvught avatar Jun 29 '23 13:06 mvught

thanks!!!, I really appreciate it; will give it a try.

cipineda avatar Jun 29 '23 14:06 cipineda

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

das197 avatar Aug 18 '23 09:08 das197

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?

pro4tlzz avatar Dec 08 '23 11:12 pro4tlzz

@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

pro4tlzz avatar Dec 08 '23 16:12 pro4tlzz

Are you able to reproduce the BPT trap error? Did you figure out what is/was causing the error?

kcrawford avatar Dec 31 '23 01:12 kcrawford

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.

pro4tlzz avatar Jan 02 '24 15:01 pro4tlzz