I wrote this because I got tired of rewriting scripts every year when Adobe adds/changes or replaces the names of their applications. It was just boring writing that stuff.
Here is a script that will mass remove based on keywords. Enjoy:
#!/bin/bash
#Requires dockutil to be installed at /usr/local/bin
#https://github.com/kcrawford/dockutil
#tnielsen 10-26-18
#Remove anything that matches the following condition that is in the list. In my case, I want to remove all adobe dock icons.
remove="Adobe"
function RemoveDockIcon () {
/usr/local/bin/dockutil --remove $1 --no-restart --allhomes
}
IFS=$'
'
apps=()
apps=($(dockutil --list | grep $remove | awk -F'file:' '{print $1}' | awk 'BEGIN{ RS = "" ; FS = "
" }{print $0}'))
#if we don't find anything, don't do anything.
if [ ! -z "$apps" ]; then
for x in ${apps[@]}; do
#Remove the trailing spaces
x="$(echo -e "$x" | sed -e 's/[[:space:]]*$//')"
echo "Removing $x from the Dock"
RemoveDockIcon $x
done
killall cfprefsd 2>&1
killall Dock 2>&1
exit 0
fi
echo "Nothing was removed"