GPG for Apple Mail (4.2) under Snow Leopard (32 and 64bit)
UPDATE: If you are using GPGmail and experiencing Problems after the Mac OS X Update to 10.6.3 as of March 30, 2010, download this file and copy it to ~/Library/Mail/Bundles to fix the error message (something like -[MimePart getNumberOfAttachments:isSigned:isEncrypted:]: unrecognized selector sent to instance 0x11b200f60) occuring when decrypting Emails. Enjoy.
—
This is for more detailed information. A ready-to-execute script without all the jabbering can be found in the accompanying blogpost!
The following scripts will install GPG (ver. 1.4.10),
the corresponding plugin (bundle) for Mail.app (ver. 1.2.0) and
“GPG Keychain access” (ver. 0.7), a key-manager.
You will instantly be able to read and write GPG-encrypted and / or signed mail without going through any complicated setup-routines.
How does GPG work?
Wikipedia will tell you.
Why would I need GPG?
Nevermind.
Ok, let’s go!
Here, I supply 2 versions of the script: A consumer version, the one most of you will use, and a paranoid version for purists like myself. If in doubt, choose the consumer version.
Consumer Version: “I have no idea what Xcode is, or what ./configure && make means”
This will download macgpg (ver. 2.0.14) as a precompiled binary and install it. This is all you need. Close Mail.app before you double-click the script to run it, as otherwise the script will end Mail.app without further notice. A window will open and ask you for your user-password on occasion. Also, the installer apps for GPGmail and Macgpg will be waiting for your input!
download, execute and you’re done!
Alternatively, you can copy and paste this into Terminal.app (which you will in Applications -> Utilities)
sudo echo "downloading MacGPG"
say "downloading Mac GPG..."
curl -O http://kent.dl.sourceforge.net/project/macgpg2/macgpg2/2.0.14/RC2/MacGPG2-2.0.14RC2.zip
unzip MacGPG2-2.0.14RC2.zip
sudo installer -pkg MacGPG2-2.0.14RC2.mpkg -target /
rm MacGPG2-2.0.14RC2.zip
rm MacGPG2-2.0.14RC2.mpkg
echo "downloading GPGMail"
say "downloading GPG Mail"
curl -O http://heanet.dl.sourceforge.net/project/gpgmail/GPGMail/1.2.0/GPGMail-1.2.0.dmg
hdiutil attach GPGMail-1.2.0.dmg
echo "now it is necessary to quit Mail.app, we'll do it the tough way..."
say "now it is necessary to quit Mail.app, we'll do it the tough way..."
sudo killall Mail
echo "please follow installer instructions and please DO NOT launch Mail afterwards. Click 'Quit'"
say "please follow installer instructions and please DO! NOT! launch Mail afterwards. Click 'Quit'"
/Volumes/GPGMail\ 1.2.0/Install\ GPGMail.app/Contents/MacOS/applet
hdiutil unmount /Volumes/GPGMail\ 1.2.0
rm GPGMail-1.2.0.dmg
echo "downloading fixed Mailbundle"
say "downloading fixed Mail bundle"
curl -O http://dl.dropbox.com/u/112247/GPGMail.mailbundle.zip
rm -rf ~/Library/Mail/Bundles/GPGMail.mailbundle
unzip GPGMail.mailbundle.zip
mv GPGMail.mailbundle ~/Library/Mail/Bundles/
rm GPGMail.mailbundle.zip
echo "downloading Keychain access"
say "downloading Keychain access"
curl -O http://mesh.dl.sourceforge.net/project/macgpg/GPG%20Keychain%20Access/0.7.0/GPG_Keychain_Access.0.7.0.1.zip
unzip GPG_Keychain_Access.0.7.0.1.zip
cd "GPG Keychain Access"
cp -rf "GPG Keychain Access.app" /Applications/
cd ..
rm -rf "GPG Keychain Access"
rm -rf "__MACOSX"
rm GPG_Keychain_Access.0.7.0.1.zip
echo "Now, create or import your keys. Then quit the app via the Command-Q keyboard shortcut"
say "Now, create or import your keys. Then quit the app via the Command Q keyboard shortcut"
/Applications/GPG\ Keychain\ Access.app/Contents/MacOS/GPG\ Keychain\ Access
echo "Ready to roll!"
say "Ready to roll!"
Okay, now for the…
Paranoid version: “I would not run code I haven’t compiled myself“
This version of the script requires Xcode for Snow Leopard. For security reasons, GPG will be compiled on your machine instead of downloading a (potentially manipulated) precompiled binary. Xcode can be installed from your Snow Leopard-DVD or downloaded from Apple.Before you run this, uncomment the corresponding line for 32 or 64bit! Don’t know which processor you have? Your friends at apple.com will tell you how to find out. You have a 64bit processor, if your processor is listed here. By the way, if you really don’t know wether your processor runs @ 64bit, you should probably stick with the consumer-version…
curl -O ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.10.tar.bz2
openssl sha1 gnupg-1.4.10.tar.bz2
# SHA1(gnupg-1.4.10.tar.bz2)= fd1b6a5f3b2dd836b598a1123ac257b8f105615d
tar xjvf gnupg-1.4.10.tar.bz2
cd gnupg-1.4.10
# for 32-bit mode machines:
# ./configure
# for 64-bit mode machines:
# ./configure --disable-asm
make
make check
# you will now be asked for you user password
sudo make install
rm ../gnupg-1.4.10.tar.bz2
cd ..
rm -rf gnupg-1.4.10
curl -O http://heanet.dl.sourceforge.net/project/gpgmail/GPGMail/1.2.0/GPGMail-1.2.0.dmg
hdiutil attach GPGMail-1.2.0.dmg
# now it is necessary to quit Mail.app, we'll do it the tough way...
killall Mail
/Volumes/GPGMail\ 1.2.0/Install\ GPGMail.app/Contents/MacOS/applet
# Mailbundle is now installed, but will not work with the latest version of Mail.app
curl -O http://dl.dropbox.com/u/112247/GPGMail.mailbundle.zip
rm -rf GPGMail.mailbundle
unzip GPGMail.mailbundle.zip
rm GPGMail.mailbundle.zip
rm -rf __MACOSX
# Now, we need The keychain acces manager
curl -O http://mesh.dl.sourceforge.net/project/macgpg/GPG%20Keychain%20Access/0.7.0/GPG_Keychain_Access.0.7.0.1.zip
unzip GPG_Keychain_Access.0.7.0.1.zip
cd "GPG Keychain Access"
mv "GPG Keychain Access.app" /Applications/
cd ..
rm -rf "GPG Keychain Access"
rm GPG_Keychain_Access.0.7.0.1.zip
# So now: let's create or import our keys...
/Applications/GPG\ Keychain\ Access.app/Contents/MacOS/GPG\ Keychain\ Access
# Having done that, we're done and ready to roll!
exit 0
These scripts are based on common knowledge that can be obtained in diverse forums. Special thanks though, go to Lastcore (see his blog) for supplying the 64bit-fix, which he found on the GPGmail development mailinglist.



