Posted on 08-09-2016 11:57 AM
The built in JAMF add dock items isn't working.
I want to try using dockutil, it looks great, how the heck do you install it easily across computers?
There's no .pkg, when I run the bundled build.sh file I get an error, if I try to copy the file into /user/sbin Finder will not allow such behavior and I don't want to have to bend over backwards to try and have it done.
Is there no simply install?
Posted on 08-09-2016 12:19 PM
Repackaging the binary after placing it at /usr/local/bin/dockutil (making sure permissions are set correctly JIC) is one method you can look for. The binary just needs to be in a place you know where it is to be executed, so you could even just put it in a custom company standard location and just manually reference it in scripts; i.e. /Library/CompanyName/dockutil.
Posted on 08-09-2016 12:24 PM
Hmm, thanks, so it seems the easiest route would be to build a composer move package to a desired location, then sending out commands, I see, thanks, I'll try it out.
Posted on 08-09-2016 12:25 PM
You just place the dockutil script/binary into whatever location you want it to go on your Mac, like /usr/local/bin/
(I would avoid to use /usr/sbin/
since that's now protected by SIP in 10.11.x)
Then open Composer, skip doing any automated capture that comes up. Drag dockutil from the Finder from wherever you installed it on your Mac into the Composer sidebar and it will create a new source and copy it into the source at the location you dragged it from (ex, /usr/local/bin/)
Then build out your package from there. You can also check the ownership/permissions beforehand in case it needs to be adjusted.
Either a pkg or dmg package should work for this. If you needed any kind of script to ride along embedded in the package, then the pkg format would be the one to use.
Take that final package and upload to Casper Admin and deploy. That's pretty much it.
Posted on 08-09-2016 12:33 PM
Even easier, if you go to the Releases tab of the GitHub page for Dockutil, you can download a PKG file:
Posted on 08-09-2016 12:34 PM
There's also an Autopkg recipe to create a PKG for Dockutil. (https://github.com/autopkg/jessepeterson-recipes/tree/master/dockutil)
There doesn't appear to be a JSS recipe at this time, but you could just take the PKG created by Autopkg and upload it manually using Casper Admin.
Posted on 08-09-2016 12:42 PM
Getting easier and easier, now we're talking, thanks!
Posted on 08-09-2016 01:46 PM
I would recommend using the AutoPkg recipe or the build.sh
script from the Git repo.
If you can post the error from the build script, we could troubleshoot it. I found that it should successfully run from inside the local clone or the folder that results from the uncompressed Github zip. If I ran it while my current working directory was somewhere else, it failed. I have run it only as a local admin.
If you are building packages another way, I would try to match the identifier and version from the build script — or at least be consistent about what you use for them within your environment, since dockutil is updated from time to time.
Posted on 08-09-2016 01:57 PM
Hi @rgranholm
I was successful in using the Jamf add Dock items in Computers>Configuration Profiles> click new then Dock
The one thing I discovered is that there can be no spaces at the beginning or at the end of the path.
I never really got good results using dockutil especially when a user logs in for the first time. They would not get the custom dock until the second or third login.
Posted on 08-09-2016 03:38 PM
@rgranholm Dockutil is really easy to install and use
If you are running El Capitan, place dockutil in the /usr/local/bin/ folder. Previous version of the OS use /usr/bin/
Create a dmg from composer and push it out to all computers.
Then is just a matter of creating a script to push out the dock items you want.
HERE is the site that you can download dockutil. You will also find the commands to use!
Posted on 08-09-2016 06:44 PM
@CapU, that sounds like dockutil was not running or delayed. Dockutil does not need to be run when a user is logged in; it can modify the Docks of all user accounts. Typically, the Dock needs to be restarted for a user that is logged in to see the changes, but that is handled by dockutil.
It is also possible that a specific version of dockutil had a particular problem. The autopkg recipe is one handy way to keep up to date with the latest releases.
@stevevalle, the build.sh command included with dockutil creates a package that puts the tool in /usr/local/bin. Jesse Peterson's autopkg recipe for dockutil does the same. No need for Composer, unless one really wants to use it.
The examples in dockutil's Github page cover a number of useful situations. They help when deciphering the various flags for the command.
Posted on 08-10-2016 08:26 AM
Thanks all, the install .pkg wasn't something I saw, I have it installed across all machines now.
However, on my first test run, had a nice hefty error to dig into. Odd it reported not being able to read the dock .plist which I imagine would be handled by dockutil
Running command dockutil --add /Users/Shared/Insigniam/Insigniam Sales Documents - Box.webloc...
Result of command:
/var/root/Library/Preferences/com.apple.dock.plist: file does not exist or is not readable or is not a regular file (Error Domain=NSCocoaErrorDomain Code=260 "The file “com.apple.dock.plist” couldn’t be opened because there is no such file." UserInfo=0x7fd571d037e0 {NSFilePath=/var/root/Library/Preferences/com.apple.dock.plist, NSUnderlyingError=0x7fd571d03550 "The operation couldn’t be completed. No such file or directory"})
failed to convert plist "/var/root/Library/Preferences/com.apple.dock.plist"
Posted on 08-10-2016 08:30 AM
@rgranholm, you're seeing that error because dockutil is running as root. You'll need to either run it as the user whose com.apple.dock.plist you're attempting to modify, or specify in your script the location of the plist to work with.
Posted on 08-10-2016 08:32 AM
Looks like whatever script you're using isn't targeting the current user's plist, and as such, since its being run by Casper as root, its trying to look for a dock.plist file in the root account's directory, which doesn't exist.
That's basically what this line in the error is stating:
/var/root/Library/Preferences/com.apple.dock.plist: file does not exist or is not readable or is not a regular file
You need to direct dockutil to a specific user's home path to affect that accounts Dock. There are probably dozens of example scripts on threads here about how to use dockutil and how to direct the utility at a user's Dock and not root's. I would look at those.
Posted on 08-10-2016 08:35 AM
Thanks! I'd like to target the currently logged in user, so I'll see if I can find examples with that, this was run with the Files and Processes, not a script, just because I didn't want to end up writing scripts for every Dock item I want to manipulate
Posted on 08-10-2016 08:58 AM
Hi @jaharmi I'm going to try the newest version of Dockutil. I had a script to run the dock as the logged in user. My test users would log in and not see the dock. Log out log back in dock shows up. I couldn't trust it to do want I wanted. It had a bit of an issue here last year with too many admins having access to Casper and not enough communication. It had to work and I wasn't confident in using Dockutil. Here's my script;
sudo -u $3 /usr/local/sbin/dockutil --remove all --no-restart
/bin/sleep 5
sudo -u $3 /usr/local/sbin/dockutil --remove 'Mail' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'Launchpad' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'Maps' --allhomes --no-restartsudo
sudo -u $3 /usr/local/sbin/dockutil --remove 'Reminders' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'iBooks' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'FaceTime' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'App Store' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'iTunes' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'Messages' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove 'Contacts' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --remove all --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Firefox.app --after 'Calendar' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Google Chrome.app --after 'Firefox' --allhomes --no-rest
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Microsoft Word.app --after 'Google Chrome' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Microsoft Excel.app --after 'Word' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Microsoft PowerPoint.app --after 'Excel' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/GarageBand.app --after 'Excel' --allhomes --no-restart
sudo -u $3 /usr/local/sbin/dockutil --add /Applications/Sibelius.app --allhomes --no-restart
killall cfprefsd
killall Dock
Posted on 07-09-2018 06:01 AM
@CapU How did you add third party apps to the list of available apps in your Jamf Configuration Profile Dock section?
EDIT: Nevermind! I see now, thanks!