Docutil question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 03-10-2025 02:41 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 03-10-2025 07:23 PM
@kwoodard Do all of the different years of the Adobe apps have the same bundle ID? (I don't have any Adobe installs handy to check) If so you could use mdfind to find what app is installed by its bundle ID and then feed that to dockutil to create a Dock entry for it. Here's an example that looks for Chrome in the /Applications folder:
#!/bin/zsh
# Utility - List all Google Chrome apps in /Applications
#
AppBundleID="com.google.Chrome"
SearchLocation="/Applications"
# Find all copies of Chrome in the /Applications folder
OIFS=$IFS
IFS=$'\n'
files=($(mdfind -onlyin "$SearchLocation" "kMDItemCFBundleIdentifier == $AppBundleID"))
IFS=$OIFS
# Loop through all found copies
for AppPath in "${files[@]}"
do
if [[ -e "$AppPath/Contents/Info.plist" ]]; then
echo $AppPath
fi
done

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 03-11-2025 10:12 AM
My scripting is still pretty terrible...how would I pass the output to docutil? I assume some sort of variable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 12:24 PM - edited 03-11-2025 01:14 PM
@kwoodard Think of it as an opportunity to improve :-)
The basic dockutil command to add an item to the Dock is "dockutil --add <path to item>" so if you just wanted to add all items that were found by mdfind in my example above to the Dock you'd replace the
echo $AppPath
with
dockutil --add "$AppPath"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 03-11-2025 12:57 PM
OK, that is kind of what I was thinking of trying later today. Thank you! I will report back if this works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@kwoodard Were you able to successfully create a script to addd random versions of Photoshop to the Dock?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have literally been working two jobs and have not had a chance to test. However, next week is the last week of instruction followed by a week of final exams. I already told my boss that I have to switch gears and work on my labs, so starting Monday, this is the first thing I will be working on. I have nearly 400 Macs that I use this with and about 12 unique docks to contend with. One modification I want to attempt is to create a master dock script that has all the software the labs use, but since the software isn’t installed on every computer, add some logic to the script that if the software is not installed, that dock item is not created (so there aren’t any ? icons). End user can still modify the dock after creation, but the initial dock will have our suggested default configuration.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
#!/bin/zsh
# List of specific bundle identifiers to add to the Dock
apps_to_add=(
"com.apple.Safari"
"com.apple.mail"
"com.google.Chrome"
"com.microsoft.Word"
)
# Path to dockutil
dockutil_path="/usr/local/bin/dockutil" # adjust if needed
# Optional: clear existing Dock items first
$dockutil_path --remove all --no-restart
# Process each bundle identifier
for bundle_id in "${apps_to_add[@]}"; do
app_path=$(mdfind "kMDItemCFBundleIdentifier == '$bundle_id'" | head -n 1)
if [[ -n "$app_path" && -e "$app_path" ]]; then
echo "Adding $app_path to Dock..."
"$dockutil_path" --add "$app_path" --no-restart
else
echo "App not found for bundle ID: $bundle_id"
fi
done
# Restart Dock once at the end
killall Dock
This is what I have come up with, but still working on it. I haven't had a chance to test, but I know the bits by themselves work. Will test and report back tomorrow.
