Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockutil 3.0.2 and Sonoma Beta 23A5276g #153

Open
cipineda opened this issue Jun 28, 2023 · 9 comments
Open

dockutil 3.0.2 and Sonoma Beta 23A5276g #153

cipineda opened this issue Jun 28, 2023 · 9 comments

Comments

@cipineda
Copy link

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.

@mvught
Copy link

mvught commented Jun 29, 2023

Tested it here and problem can you share your script

@cipineda
Copy link
Author

setDockScript.sh.zip

@mvught
Copy link

mvught commented Jun 29, 2023

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!

@cipineda
Copy link
Author

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

@das197
Copy link

das197 commented Aug 18, 2023

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

@pro4tlzz
Copy link

pro4tlzz commented Dec 8, 2023

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
Copy link

pro4tlzz commented Dec 8, 2023

@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

@kcrawford
Copy link
Owner

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

@pro4tlzz
Copy link

pro4tlzz commented Jan 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants