Skip to content

Instantly share code, notes, and snippets.

@MattiSG
Created October 13, 2012 17:38
Show Gist options
  • Save MattiSG/3885493 to your computer and use it in GitHub Desktop.
Save MattiSG/3885493 to your computer and use it in GitHub Desktop.
Automatically add GrowlMail plugin compatibility to the latest Mail.app version
# Updates the Growl Mail plugin when unknown compatibility preemptive deactivation happens.
# This consists in finding the “compatibility UUID” for the new Mail version, and adding it to the supported UUIDs of GrowlMail.
#
# See http://langui.sh/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/ for more details on the procedure.
#
# Author: Matti Schneider <[email protected]>
# Either ~/Library or /Library depending on the type of install (local or global).
INSTALL_ROOT="/Users/`whoami`/Library/Mail/" # the default is to assume a local install
BUNDLE_NAME="GrowlMail.mailbundle"
DEST_NAME="$INSTALL_ROOT/Bundles/$BUNDLE_NAME"
read -n 1 -p "The plugin update procedure will start by quitting Mail. Press enter when you're ready to have Mail killed."
killall Mail 2> /dev/null # quit Mail.app
uuids=$(defaults read com.apple.mail MessageTracerInfo | grep UUID | cut -d '"' -f 2) # here are the new UUIDs we need to add to the bundle's supported list
deactivatedBundlesFolder="$(ls -1 $INSTALL_ROOT | grep "Bundles (")" # the deactivated folder name is localized, so we can only rely on its name having a parenthesis
if ! [[ -e "$INSTALL_ROOT/$deactivatedBundlesFolder/$BUNDLE_NAME" ]]
then
echo "No deactivated GrowlMail bundle found. Aborting."
exit 1
fi
mv "$INSTALL_ROOT/$deactivatedBundlesFolder/$BUNDLE_NAME" "$DEST_NAME"
defaults write "$DEST_NAME/Contents/Info" SupportedPluginCompatibilityUUIDs -array-add $uuids
echo "Done! :)"
open -a Mail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment