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.02 hangs with macOS 12.5.1 #139

Open
ArminDeeg opened this issue Sep 13, 2022 · 16 comments
Open

Dockutil 3.02 hangs with macOS 12.5.1 #139

ArminDeeg opened this issue Sep 13, 2022 · 16 comments

Comments

@ArminDeeg
Copy link

ArminDeeg commented Sep 13, 2022

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`

@Lotusshaney
Copy link

Looks to be the same as #126

Try running it in the user space

@ArminDeeg
Copy link
Author

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

@Lotusshaney
Copy link

@ArminDeeg
Copy link
Author

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'

@Lotusshaney
Copy link

Lotusshaney commented Sep 13, 2022

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

@Lotusshaney
Copy link

#!/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

@ArminDeeg
Copy link
Author

Thank

got it working with this script:

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

looks similar to your one

Armin

@GitSweetDragon
Copy link

GitSweetDragon commented Oct 31, 2022

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 ?

@mvught
Copy link

mvught commented Nov 1, 2022

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

@GitSweetDragon
Copy link

GitSweetDragon commented Nov 1, 2022

@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

@mvught
Copy link

mvught commented Nov 10, 2022

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

@GitSweetDragon
Copy link

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

On this repo "GitSweetDragon" ?
Yes

@mvught
Copy link

mvught commented Nov 10, 2022

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

@GitSweetDragon
Copy link

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

@mvught
Copy link

mvught commented Nov 11, 2022

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

mvught commented Nov 16, 2022

And?

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

4 participants