1

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.

2 Answers 2

2

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

0

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

http://iharder.sourceforge.net/current/macosx/abfind/

4
  • How does it work in 10.11 when its not compatible with OS versions never than 10.7 ?
    – clhy
    Jan 23, 2016 at 10:46
  • 1
    as i wrote "ABFind runns just fine on 10.11", contacts does not.
    – Nullx8
    Jan 23, 2016 at 16:24
  • @pun "contacts" (CLI app) != "Contacts" (MacOS built-in app).
    – Tom Hundt
    Jul 25, 2019 at 23:49
  • ABFind not working for me on 10.14.5.
    – Tom Hundt
    Jul 25, 2019 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .