How do I read data from my Address Book card from the command line?

  • Question

    From a Mac OS command line, I’m looking for a command that will read my address book card and print my email address to stdout.

    Doing it via an osascript command would be fine.

    What you are looking for is contacts.

    The utility contacts gives you access to view and search all your records in the AddressBook database.

    Without further ado, here are a few examples:

    $ contacts -h usage: contacts [-hHsmnlS] [-f format] [search]       -h displays help (this)       -H suppress header       -s sort list       -m show me       -n displays note below each record       -l loose formatting (doesn't truncate record values)       -S strict formatting (doesn't add space between columns)       -f accepts a format string (see man page)  displays contacts from the AddressBook database 

    ABFind from iHarder is your friend.

    contacts (as mentioned in the other answer is great app, but its not compatible to osx versions newer than 10.7

    ABFind runns just fine on 10.11 and returns a sort-of json response


    • How does it work in 10.11 when its not compatible with OS versions never than 10.7 ?

    • 1

      as i wrote “ABFind runns just fine on 10.11”, contacts does not.

    • @pun “contacts” (CLI app) != “Contacts” (MacOS built-in app).

    • ABFind not working for me on 10.14.5.

  • You must be logged in to reply to this topic.