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...
Modify the lbdb Options:
#!/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/
Change this line (line 42):
sudo pico /usr/local/lbdb/etc/lbdb.rc
# METHODS="m_inmail m_passwd m_finger"
and uncomment the following lines (line 67-68):
Modify Your Mutt Options:
#MUTT_DIRECTORY="$HOME/.mutt" #MUTTALIAS_FILES=".muttrc .mail_aliases muttrc aliases"
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.
set query_command="/usr/local/lbdb/bin/lbdbq '%s'"
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.
The Little Brother's Database (lbdb)
Mark's Mutt Fan and Tip page
Mac OS X Hints