Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use the Mac OS X Address Book with mutt UNIX
If you use the CLI mail client mutt, you can have it query your Mac OS X Address Book with a few simple steps:
  1. Download, compile and install The Little Brother's Database (lbdb)
  2. Modify the lbdb options
  3. Modify your mutt options to query lbdb
Read the rest of the hint for a detailed step-by-step guide...

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:
You need to modify a few things in the lbdb configuration file. Open the config file with your favorite editor:
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:
Now you need to tell mutt to use lbdb to query the Mac OS X Address Book. Add the following line somewhere in your mutt options. For most people, that will probably be ~/.mutt/muttrc or ~/.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.

Thats it! Restart mutt. Now to use it, simply start addressing a new message, type a few characters of the name. Then type Control-T, and lbdb will query your mutt aliases file and your Mac OSX Address Book, looking for an approriate entry. Select an entry and continue with your message composition.

Note:

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

    •    
  • Currently 2.63 / 5
  You rated: 5 / 5 (8 votes cast)
 
[42,337 views]  

Use the Mac OS X Address Book with mutt | 10 comments | Create New Account
Click here to return to the 'Use the Mac OS X Address Book with mutt' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use the Mac OS X Address Book with mutt
Authored by: Numbski on Oct 26, '04 04:24:59PM
Thankfully, this works for pine too with a little bit of modification. Sweet tip!

http://www.spinnaker.de/lbdb/

[ Reply to This | # ]

Use the Mac OS X Address Book with mutt
Authored by: hardcoreUFO on Oct 27, '04 11:19:49AM

It is positively *shameful* that mutt can use the apple address book and entourage can't. The Microsoft folks are supposed to be smart; this shows that they are not all that smart.



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: spork on Oct 27, '04 07:50:34PM

You mention pine, but I see no hooks in pine to use an external program like this to query for addresses... How did you get pine to use lbdbq?



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: tpavlic on Feb 28, '06 09:26:02AM

This hack does not integrate the OS X address book with pine. lbdb can READ the pine address book, but it cannot integrate with pine's address book. This is because pine has no way to query out to a program to get its address book info; it must be read from a file. (and you really can't even setup a nifty named pipe to fake pine out because pine expects all addresses to be in that file ahead of time There's simply no way to ‘query' the file)

NOTE: There are ways to make bbdb WRITE pine address books:

http://www.geocities.com/kensanata/bbdb-funcs.html#2

I don't know if you can integrate bbdb with the OS X address book. And regardless, this would require periodically syncing your bbdb address book to a file.

So that sucks.

HOWEVER, PINE address books *CAN* be stored on an remote IMAP server. This means that if you keep your address information (very limited in pine) on the server, on ANY pine you open up regardless of location, you'll get the same address book. Pine does the same thing with configuration. This is one of the strengths of pine. Imagine if you could open up Thunderbird or Mail ANYWHERE and have it DOWNLOAD a configuration and an address book automatically. You would only have to configure your mail app once and any changes would automatically propagate to every other machine you use without you having to do anything.



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: lee1 on Oct 27, '04 03:16:25PM

I was just wondering the other day if it might be possible to hook mutt in to the AddressBook database, rather than maintaining a redundant alias file for mutt. So thanks!



[ Reply to This | # ]
How about Thunderbird?
Authored by: erikhansen on Oct 30, '04 11:33:45PM

How about Address Book and Thunderbird? Does anyone have any ideas on how to sync them?

Not a huge fan of Mail.app but depend alot on iSync...

Thanks,
-erik



[ Reply to This | # ]
How about Thunderbird?
Authored by: tpavlic on Feb 28, '06 09:15:37AM

While you currently cannot integrate Thunderbird directly from the Address Book, you can use Quicksilver to blend the two together slightly.

Quicksilver looks through your address book. You can use "comma" to build a list of e-mail addresses within Quicksilver. Then you can tab over to the action field and type "Compose" to bring up "Compose E-mail To...". If Thunderbird is your default e-mail client, it will send an e-mail to the people Quicksilver has picked out of your address book.



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: sean9 on Jan 11, '07 11:06:22PM

Heya... I'm trying this out. Have everything installed on my Mac, and lbdbq can successfully query the mac address book. But mutt does not find them. Any suggestions how to debug? I've tried all these:

set query_command="lbdbq %s"
#set query_command="/usr/local/bin/lbdbq '%s'"

Tried with and without quotes. I'm guessing a path problem, or a library
problem (from inside mutt) but don't know how to troubleshoot it.

Suggestions?

Thanks a million!!

Sean



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: isola009 on Nov 29, '10 02:12:32AM

It doesn't compile!!!!



[ Reply to This | # ]
Use the Mac OS X Address Book with mutt
Authored by: lix on Nov 08, '11 03:23:29PM

For European users you might want to add
<code>| iconv -f MACROMAN</code>
to see diacritics () properly.
Full code:
<code>set query_command = "contacts -Ssf '%eTOKEN%n' '%s' | sed -e 's/TOKEN/\t/g' | iconv -f MACROMAN"</code>



[ Reply to This | # ]