How to automatically mount favorite volumes with TrueCrypt for Mac

TrueCrypt is a very nice, cross-plateform encryption tool. It allows you to mount an encrypted file as a virtual external drive. This is particularly convenient to protect files used by other applications without them being aware of it. For example I usually store my Firefox profiles (with all my saved passwords) on such an encrypted volume.

However the Windows version of TrueCrypt has a nice feature that for some reason is not available in the Mac version: you can ask the Windows version to start automatically when you log into Windows and to mount all the drives that you have marked as favorites. This is particularly convenient if like me you use a TrueCrypt volume all the time. On a Mac, it is fairly easy to make an application start automatically at login but here we need the extra step of mounting all the favorites volume. As it turns out, TrueCrypt has a command line option to mount all the favorites so all we need is to launch TrueCrypt with that option.

A simple way to do this is to use a launchd agent. It is a simple XML file that you can download here and put in the directory ~/Library/LaunchAgents inside your user home folder. The ~/Library folder may be hidden by default on your Mac, see this article on how to access it. If you have several users on your Mac and you want the same behavior for all of them, you can also put the plist file in the directory /Library/LaunchAgents at the root of your system drive.

If you are curious, the content of the plist file is pretty simple:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
	http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.truecrypt.auto-mount-favorites</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt</string>
<string>--auto-mount=favorites</string>
</array>
</dict>
</plist>

 So if you have installed TrueCrypt somewhere other than the Applications folder, you can easily adjust the path in the plist file. You can also play with the other command line options listed by the following command:

$ /Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -h

 Short URL for this post: http://lepl.us/1i