Default Dock in Lab Environments

ctarbox
Contributor II

If you have been successful in creating a default dock in a Lab Environment that builds at login (without having to refresh after the Desktop builds) for network (AD specifically) users that do not have a networked home directory, could you please share how you accomplished this?

Many thanks!
Cheryl

3 REPLIES 3

stevevalle
Contributor III

We use dockutil to create the dock, along with a cached policy runs at login to create a default dock (at every login). However, it is done once the user is created and logged in. Not sure if there is any way around this.

Here is a snippet of our script:

#!/bin/sh
user=$(ls -la /dev/console | cut -d " " -f 4)
plist="/Users/$user/Library/Preferences/com.apple.dock.plist"

/usr/local/bin/dockutil --remove all --no-restart $plist
sleep 2

# Browsers
/bin/test -e '/Applications/Firefox.app' && /usr/local/bin/dockutil --add '/Applications/Firefox.app' --no-restart $plist
/bin/test -e '/Applications/Safari.app' && /usr/local/bin/dockutil --add '/Applications/Safari.app' --no-restart $plist

# Apple Apps
/bin/test -e '/Applications/Final Cut Pro.app' && /usr/local/bin/dockutil --add '/Applications/Final Cut Pro.app' --no-restart $plist
/bin/test -e '/Applications/DVD Studio Pro.app' && /usr/local/bin/dockutil --add '/Applications/DVD Studio Pro.app' --no-restart $plist
/bin/test -e '/Applications/Compressor.app' && /usr/local/bin/dockutil --add '/Applications/Compressor.app' --no-restart $plist


# Adobe Apps
/bin/test -e '/Applications/Adobe Acrobat DC/Adobe Acrobat.app' && /usr/local/bin/dockutil --add '/Applications/Adobe Acrobat DC/Adobe Acrobat.app' --no-restart $plist
etc...

# Microsoft Applications
/bin/test -e '/Applications/Microsoft Word.app' && /usr/local/bin/dockutil --add '/Applications/Microsoft Word.app' --no-restart $plist

etc...
etc...
etc...

killall cfprefsd
killall Dock

The docks plist file is wiped clean, dockutil adds the dock items to the plist and at the end of the script we kill the dock and have our default dock!

Hope that helps.

mradams
Contributor

We transitioned away from using dockutil with the update to MacOS Sierra. We now use Configuration profiles and configure the Dock Items as necessary to only display the apps necessary per lab. For Staff we select "Merge with User's Dock" and under Dock items add in any additional apps we want displayed on the dock. This has been working for both users with home directories and generic accounts without home directories.

ctarbox
Contributor II

Thanks to both of you for your responses.

@stevevalle , I will adjust my dockutil script to reflect your's and see if I can pick up some time for the dock refresh.

@mradams , I will trim down my dock offerings and play around a bit more with the Configuration Profiles.