I have been using docutil for many years at this point (along with BuildADock). It works great. I am building a new lab and it's a weird setup. Not every computer will have the same versions of software installed (mainly Adobe) for some stupid licensing issues. I'm wondering if there is a way to use wildcards in the docutil script? For example, I have three sets of computers that have either Adobe CC 2023, 2024, or 2025. The software installs are the same, but the version year is different. Rather than make different docks for all the variations in the lab, is there a way to use a wildcard so it puts whichever version of Photoshop onto the dock that is installed onto the computer?
Solved
Docutil question.
Best answer by kwoodard
OK, that is kind of what I was thinking of trying later today. Thank you! I will report back if this works.
@kwoodard Were you able to successfully create a script to addd random versions of Photoshop to the Dock?
OK. Got to spend some time on this and have a working script. Hope you and others find this helpful.
Considering making this a new thread as well to get more traction...what do you think?
#!/bin/zsh
# Get current user and home directory
currentUser=$(stat -f "%Su" /dev/console)
userHome=$(dscl . -read /Users/"$currentUser" NFSHomeDirectory | awk '{print $2}')
markerPlist="$userHome/Library/Preferences/com.ARC.docksetup.plist"
# --- 1. Check for existing Dock setup marker ---
if [[ -f "$markerPlist" ]]; then
echo "Dock already set up for $currentUser. Exiting."
exit 0
fi
# --- 2. Wait for Dock process to be ready ---
echo "Waiting for Dock to launch..."
until pgrep -x Dock >/dev/null; do
sleep 1
done
echo "Dock is running. Proceeding..."
# --- 3. Define bundle IDs to add to Dock ---
bundleIDs=(
"com.apple.launchpad.launcher"
"com.apple.Safari"
"com.google.Chrome"
"com.apple.mail"
"com.apple.iCal"
"com.apple.Notes"
"com.microsoft.Word"
"com.microsoft.Excel"
"com.microsoft.Powerpoint"
"com.adobe.Acrobat.Pro"
"com.jamfsoftware.selfservice.mac"
"com.apple.systempreferences"
)
dockutil="/usr/local/bin/dockutil"
# --- 4. Ensure dockutil is installed ---
if [[ ! -x "$dockutil" ]]; then
echo "dockutil not found at $dockutil. Please install it."
exit 1
fi
sleep 2
echo "Removing existing Dock items..."
$dockutil --remove all --no-restart "$userHome"
sleep 2
echo "Adding applications to the Dock from bundle IDs..."
for bundleID in "${bundleIDs[@]}"; do
appPath=$(mdfind "kMDItemCFBundleIdentifier == '$bundleID'" | grep -m1 '\.app$')
if [[ -n "$appPath" && -e "$appPath" ]]; then
echo "Adding: $appPath"
$dockutil --add "$appPath" --no-restart "$userHome"
sleep 1
else
echo "Could not find app for bundle ID: $bundleID"
fi
done
sleep 2
echo "Restarting Dock..."
killall Dock
# --- 5. Set Dock preferences: size and magnification ---
echo "Setting Dock preferences..."
defaults write com.apple.dock tilesize -int 36
defaults write com.apple.dock magnification -bool true
defaults write com.apple.dock largesize -int 64
# --- 6. Create marker plist to prevent re-running ---
echo "Creating marker plist to mark completion..."
defaults write "$markerPlist" setupComplete -bool true
# --- 7. Final Dock restart to apply preferences ---
killall Dock
echo "Dock setup complete for user: $currentUser"
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
