A LaunchAgent and .app to build a user's Dock upon login and/or on demand.
A LaunchAgent and .app to build a user's Dock upon login and/or on demand.
DockBuilder allows for the building of a user's Dock based on an organization's needs. DockBuilder eliminates the need for a user template which only allows for a static Dock for all users, and template manipulation can cause issues in newer versions of macOS. DockBuilder not only allows for easy creation of a new user's Dock out of the box, but also has the potential to dynamically set up a different Dock for users based on some criteria; like AD groups for example (you'd have to modify the source based on your criteria).
Note: Dockutil is also required, but included in the resulting .pkg and releases.
To build new versions you can simply run the build.sh script and specify a version number for both the .app and .pkg. The resulting .pkg will include the LaunchAgent and .app as well as necessary preinstall/postinstall scripts. If you do not include a version number as a parameter then version 1.0 will be assigned as the default.
# Clone the repo and traverse into the created directory
git clone https://github.com/ryangball/DockBuilder.git
cd DockBuilder
# At this point you'd customize the variables in the build.sh script
# Build the .pkg
./build.sh 1.5
Within the build.sh script, you can modify the top-most variables to create a custom DockBuilder .app and .pkg.
Some things to keep in mind:
To test DockBuilder, install the .pkg, then unload/load/start the LaunchAgent.
# Delete the breadcrumb for the user if it exists
find ~/Library/Preferences -name com.github.ryangball.dockbuilder.breadcrumb.plist -delete
# Unload the LaunchAgent
launchctl unload /Library/LaunchAgents/com.github.ryangball.dockbuilder.plist
# Load the LaunchAgent
launchctl load /Library/LaunchAgents/com.github.ryangball.dockbuilder.plist
# Start the LaunchAgent (if necessary)
launchctl start com.github.ryangball.dockbuilder
# Tail the log to see what is occurring
tail -f ~/Library/Logs/DockBuilder.log
Upon DockBuilder's execution, a breadcrumb is placed into the user's home folder by default: ~/Library/Preferences/com.github.ryangball.dockbuilder.breadcrumb.plist
In the event that this breadcrumb exists for a user, DockBuilder will exit without any action. To re-create a user's Dock, open terminal as the user and run the following to remove the breadcrumb:
rm ~/Library/Preferences/com.github.ryangball.dockbuilder.breadcrumb.plist
Then you can simply run the /Applications/Utilities/DockBuilder.app or unload/load the LaunchAgent as per the Testing section above.
Dockutil is included in the resulting .pkg and is licensed under the Apache 2.0 license. Dockutil is automatically downloaded from the releases section when using the build.sh script, or included if you download one of the DockBuilder Releases.