dockutil icon indicating copy to clipboard operation
dockutil copied to clipboard

Dockutil 3.02 hangs with macOS 12.5.1

Open ArminDeeg opened this issue 2 years ago • 16 comments

This postinstall script hangs endless with dockutil 3.0.2 any suggestions ? happens with macOS 12.5.1 Intel iMac 5K 2020

`#!/bin/sh

OLDIFS=$IFS IFS='.' read osvers_major osvers_minor osvers_dot_version <<< "$(/usr/bin/sw_vers -productVersion)" if [ ${osvers_major} = 10 ]; then /Users/Shared/Dockutil/dockutil --add /Applications/EXPOSÉ\ X\ Client/EXPOSE\ X\ Client.app "$HOME" echo 'docutil v2' else /Users/Shared/Dockutil/dockutil3 --add /Applications/EXPOSÉ\ X\ Client/EXPOSE\ X\ Client.app "$HOME" echo 'docutil v3' fi

exit 0`

ArminDeeg avatar Sep 13 '22 08:09 ArminDeeg

Looks to be the same as https://github.com/kcrawford/dockutil/issues/126

Try running it in the user space

Lotusshaney avatar Sep 13 '22 08:09 Lotusshaney

Looks to be the same as #126

Try running it in the user space

wow fast answer, thanks.

Do you have a sample to avoid try and error for me?

Thanks Armin

ArminDeeg avatar Sep 13 '22 08:09 ArminDeeg

Have a look here,

https://scriptingosx.com/2020/08/running-a-command-as-another-user/

Lotusshaney avatar Sep 13 '22 08:09 Lotusshaney

I tried this with your hint.

it works when I drag the postinstall script in the terminal window. But when I use it from a pkg installer as postinstall it does not work. But a tiny success, docutil does not hangs anymore. But the desired icon was not created inside the dock.

'#!/bin/sh

currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
/Users/Shared/Dockutil/dockutil3 --add /Applications/EXPOSÉ\ X\ Client/EXPOSE\ X\ Client.app /Users/$currentUser/Library/Preferences/com.apple.dock.plist

exit 0'

ArminDeeg avatar Sep 13 '22 09:09 ArminDeeg

you need to run the dockutil command as the user. Your example is not doing that, its just getting the current user

Lotusshaney avatar Sep 13 '22 10:09 Lotusshaney

#!/bin/sh

#Define Func
runAsUser() {
	currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
	uid=$(id -u "$currentUser")  
	if [ "$currentUser" != "loginwindow" ]; then
		launchctl asuser "$uid" sudo -u "$currentUser" "$@"
	fi
}

runAsUser /Users/Shared/Dockutil/dockutil3 --add /Applications/EXPOSÉ\ X\ Client/EXPOSE\ X\ Client.app /Users/$currentUser/Library/Preferences/com.apple.dock.plist

exit 0

Lotusshaney avatar Sep 13 '22 10:09 Lotusshaney

Thank

got it working with this script:

https://github.com/mvdbent/setDock/blob/main/setDock-addToDock.sh

looks similar to your one

Armin

ArminDeeg avatar Sep 13 '22 10:09 ArminDeeg

Hello,

i have tried https://github.com/mvdbent/setDock/blob/main/setDock-addToDock.sh and get this error :

Script exit code: 1

Script result: Dockutil version = 3.0.2no appPath set Error running script: return code was 1.

i used jamf pro 10.42

i have also tried ths but nothing append except relaod dock

#!/bin/zsh

dockutilbin=$(/usr/bin/which dockutil)
loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
loggedInUserPlist="/Users/$loggedInUser/Library/Preferences/com.apple.dock.plist"

# Create a clean Dock
dockutil --remove all --no-restart
echo "clean-out the Dock"

# Setup dock, in various examples
dockutil --add /System/Applications/System\ Preferences.app --position 1 --no-restart
dockutil --add /Applications/DisplayLink\ Manager.app --position 2 --no-restart
dockutil --add /Applications/Self\ Service.app  --position 3 --no-restart
dockutil --add /System/Applications/Calculator.app --position 4 --no-restart
dockutil --add /Applications/Safari.app --after 'Calculator' --no-restart
dockutil --add /Applications/Google\ Chrome.app --after 'Safari' --no-restart
dockutil --add /Applications/Microsoft\ Teams.app --after 'Google Chrome' --no-restart
dockutil --add /Applications/Microsoft\ Outlook.app --after 'Microsoft Teams' --no-restart
dockutil --add /Applications/Microsoft\ Word.app --after 'Microsoft Outlook' --no-restart
dockutil --add /Applications/Microsoft\ Excel.app --after 'Microsoft Word' --no-restart
dockutil --add /Applications/Microsoft\ PowerPoint.app --after 'Microsoft Excel' --no-restart
dockutil --add /System/Applications/Utilities/Screenshot.app --before 'Self Service' --no-restart
dockutil --add '/Applications' --view grid --display folder --allhomes
dockutil --add '~/Desktop' --view grid --display folder --allhomes
dockutil --add '~/Downloads' --view grid --display folder --allhomes

exit 0

Or how to user DockUtil.swift with jamf please ?

GitSweetDragon avatar Oct 31 '22 12:10 GitSweetDragon

Use the script from mvdbent that's working, make it easy and simple 😉

mvught avatar Nov 01 '22 06:11 mvught

@mvught thanks but it's not working for me. i create m repo https://github.com/GitSweetDragon/dockutil i don't how to share it

GitSweetDragon avatar Nov 01 '22 22:11 GitSweetDragon

is this your script? dockutil_corp-settings.sh? in the repo?

mvught avatar Nov 10 '22 16:11 mvught

is this your script? dockutil_corp-settings.sh? in the repo?

On this repo "GitSweetDragon" ? Yes

GitSweetDragon avatar Nov 10 '22 19:11 GitSweetDragon

Ok man I read your story and I can help you. I have the same environment ass you are, wat you have to do: -First enroll the machine -After reboot use Outset to "run once login"

Outset you set de dock setting and other things if you like.

If you have slack you can pb me, and find me under the same name #macadmins channel and share you more.

let me know if this make sense to you and happy to help

mvught avatar Nov 10 '22 20:11 mvught

Thanks you ☺️. I don't have access to slack macadmin. I try to register but doesn't work.

GitSweetDragon avatar Nov 10 '22 20:11 GitSweetDragon

First you need Outset: https://github.com/chilcote/outset/releases Make a package in Composer: image if have 3 in here but you can drop your Dock in there.

Deploy this 2 in your deployment!

Thats al you need ;) After enrollment you reboot and then login again and than boom ;)

mvught avatar Nov 11 '22 16:11 mvught

And?

mvught avatar Nov 16 '22 21:11 mvught