If you use the CLI mail client mutt, you can have it query your Mac OS X Address Book with a few simple steps:
Download and Install lbdb
Create the following script and make it executable (chmod +x script_name) to download, compile, and install the Little Brother's Database. Or you can do it yourself if you prefer...
#!/bin/sh
# This script will download the source code
# for lbdb, compile and install it in
# /usr/local/lbdb self-contained location.
#
# You must have Developer Tools installed to compile
# Download the source code
curl -O http://www.spinnaker.de/debian/lbdb_0.29.tar.gz
tar -zxvf lbdb_0.29.tar.gz
cd lbdb_0.29
# Configure, compile, and install
./configure --prefix=/usr/local/lbdb --libdir=/usr/local/lbdb/lib
sudo make install
# Move the man pages to a more friendly location
ln -s /usr/local/lbdb/man/man1/* /usr/local/man/man1/
Modify the lbdb Options:sudo pico /usr/local/lbdb/etc/lbdb.rc
Change this line (line 42):
# METHODS="m_inmail m_passwd m_finger"
To this:
METHODS="m_muttalias m_osx_addressbook"
and uncomment the following lines (line 67-68):
#MUTT_DIRECTORY="$HOME/.mutt"
#MUTTALIAS_FILES=".muttrc .mail_aliases muttrc aliases"
Modify Your Mutt Options:set query_command="/usr/local/lbdb/bin/lbdbq '%s'"
If you installed lbdb in a location other than as shown in Step 1 above, then alter the path as needed to point to the correct lbdb binary.
There are MANY more options available for lbdb, including harvesting addresses from incoming mail, using gnupg, ldap lookup, etc. If you need those functions, be sure to look at the man page for lbdbq and also the sources listed below.
Sources:
The Little Brother's Database (lbdb)
Mark's Mutt Fan and Tip page
Mac OS X Hints
http://hints.macworld.com/article.php?story=20041024163030501