Remove App from Dock
I know how add an app to the dock using unix but how do you remove one from the Dock? I have read a lot about using plistbuddy to remove it but I can not figure it out. I want to put this script in a installer/uninstaller.
Apple Event: May 7th at 7 am PT
I know how add an app to the dock using unix but how do you remove one from the Dock? I have read a lot about using plistbuddy to remove it but I can not figure it out. I want to put this script in a installer/uninstaller.
Got it! You can use this script:
!/bin/bash
i="$(defaults read com.apple.dock persistent-apps | grep _CFURLString\" | awk '/What ever app you want/ {print NR}')"
for j in `echo "$i" | tr " " "\n" | sort -gr`
do
/usr/libexec/PlistBuddy -c "Delete persistent-apps:$[$j-1]" ~/Library/Preferences/com.apple.dock.plist
done
killall Dock
just save that as a executable file and you are good to go.
Got it! You can use this script:
!/bin/bash
i="$(defaults read com.apple.dock persistent-apps | grep _CFURLString\" | awk '/What ever app you want/ {print NR}')"
for j in `echo "$i" | tr " " "\n" | sort -gr`
do
/usr/libexec/PlistBuddy -c "Delete persistent-apps:$[$j-1]" ~/Library/Preferences/com.apple.dock.plist
done
killall Dock
just save that as a executable file and you are good to go.
Forget the looping, do the math in bash ->
i=$(( $(defaults read com.apple.dock persistent-apps | grep _CFURLString\" | awk '/What ever app/ {print NR}') -1 ))
/usr/libexec/PlistBuddy -c "Delete persistent-apps:$i" ~/Library/Preferences/com.apple.dock.plist
Note the missing colon at the start of persistent-apps. <comment>I'm not liking this new forum software</comment>
Ok, I understand why you're looping. But it would be silly to have more than one of the same app in the dock.
Message was edited by: Mark Jalbert
Remove App from Dock