I have a need (like for Mutt's query_command) to search for email addresses from OS X's Address Book.app, but from the command line. After trying various hints, code, etc., and getting frustrated, I found that it's just stored in sqlite3. Everything is already built into OS X, you just have to figure out the SQL structure. I've only tested this on 10.6, but I imagine it will either work as is, or be easily adapted to work, on 10.5.

I created a shell script called abook.sh in /usr/local/bin with these contents:
#!/bin/sh
sqlite3 -separator '    ' ~/Library/Application\ Support/AddressBook/AddressBook-v22.abcddb "select e.ZADDRESSNORMALIZED,p.ZFIRSTNAME,p.ZLASTNAME,p.ZORGANIZATION from ZABCDRECORD as p,ZABCDEMAILADDRESS as e...

Add to digg Add to Reddit Add to Slashdot Email this Article Add to StumbleUpon


[Read more...]

Leave a Reply

You must be logged in to post a comment.