My Macbook Pro under Sierra is now at the Repair Shop. I am using another MacBook Pro under Yosemite while my Sierra machine is being repaired. However, I forgot to export Contacts before taking my Sierra machine in this morning and now my Contacts data is 3 years old, which is pretty well useless to me. It should be no problem, because all the necessary info is on my Time Machine linked to Sierra. However, things are not so simple (at least for me).

How can I now get my contacts info onto the Yosemite machine from the Sierra-based Time Machine backup? It seems that none of the published solutions works.

  • Please link at least some solutions which don't work to avoid answers based on them.
    – klanomath
    Feb 23, 2017 at 15:21

1 Answer 1


Update: I have updated the script as per @user3439894’s feedback. The script should now work for most users, no matter what flavor their address book raw data is in.

You might want to look at a temporary command-line solution. It gives you a contact <search_term> command that you can run in Terminal.app to look up contacts.

I assume your Yosemite MBP is only a temporary solution while your Sierra MBP is at the repair shop. While the Terminal command has limited functionality, it might work well enough for you to be useful while you wait for your Sierra MacBook Pro to return.

Setting up the temporary command should require not more than 10–15 minutes.

Setting up the contact command

  1. Open the Time Machine backup that contains your (Sierra-based) address book data.

  2. In your backup, look for the folder "${HOME}/Library/Application Support/AddressBook", which is the root folder for all your contact data.

  3. Restore that entire AddressBook folder to a temporary location, e. g.: ${HOME}/SierraAddressBook.

  4. Double check that the whole ${HOME}/SierraAddressBook tree has the correct permissions so you can read it without an administrator password.

  5. For good measure, make a backup copy of your ${HOME}/.bash_profile file.

  6. Open the file ${HOME}/.bash_profile in a text editor of your choice.

  7. Temporarily append to .bash_profile the following lines:

(Note that for some of these lines, indentation matters; try not to change indentation in any of those lines, even if it looks a bit off.)

contact() {
  # We assume "${HOME}/Library/Application Support/AddressBook"
  # has been restored to this directory from a TM backup.
  local contacts_base_dir="${HOME}/SierraAddressBook"

  local search_term="$1"
  local sql_code="$(cat << EOF
.mode column
        TRIM(       IFNULL(R.ZFIRSTNAME, '')
          || ' ' || IFNULL(R.ZLASTNAME, '')
          || ' ' || IFNULL(R.ZORGANIZATION, '')) NAME,
        'created ' || date('2001-01-01', ZCREATIONDATE
          || ' seconds', 'localtime') CREATED,
        'modified ' || date('2001-01-01', ZMODIFICATIONDATE
          || ' seconds', 'localtime') MODIFIED,
          '! _$<>') || ' ' || IFNULL(E.ZADDRESSNORMALIZED, ''))
          '! _$<>') || ' ' || IFNULL(P.ZFULLNUMBER, ''))
        NAME LIKE '%${search_term}%'
      GROUP BY
      ORDER BY

  export sql_code
  find "${contacts_base_dir}" -regex '.*/AddressBook-[^/]*\.abcddb$' \
    -exec bash -c "/usr/bin/sqlite3 '{}' <<< \"\${sql_code}\"" \;

export -f contact
  1. Save your changes in .bash_profile.

  2. Open Terminal.app.

  3. Open a new terminal window.


Run the command contact followed by your search term in the Terminal. For example:

$ contact "Bella Napoli"

Bella Napoli  created 2013-10-12  modified 2015-05-29              Home +49 931 51706

$ contact IKEA

IKEA Frankfurt  created 2013-10-12  modified 2013-10-12              Work 0180 5 353435

$ contact Neptun

Hotel Neptun  created 2013-10-12  modified 2013-10-12  Work [email protected]
Work +49 381 777-0,WorkFAX +49 381 54023

$ contact

<lists all your contacts>


  • The search term only applies to first name, last name, and organization name.
  • The search term is case sensitive.
  • The search term cannot contain spaces or certain punctuation, unless it is enclosed in the proper single or double quotes.
  • To search by full name, use the correct order: <first_name> <last_name> <organization_name>
  • Search terms can also be substrings of names.
  • I do not endorse any of the companies and their products and services I gave in the example. I used those because I cannot disclose personal data for obvious reasons. Besides, I was too lazy to add bogus data to my own address book.
  • I’ve tested the script on El Capitan only but it should work on Yosemite, even when combined with Sierra-based address book data.
  • If you run into issues, feel free to leave a comment below.
  • 1
    Have you tried to just copy the (Sierra) /.../backup.*/.../${HOME}/Library/Application Support/AddressBook to (Yosemite) ${HOME}/Library/Application Support/AddressBook after renaming the old (Yosemite) AddressBook folder? A quick check using two life systems revealed that this seems to work.
    – klanomath
    Feb 23, 2017 at 18:10
  • 1
    @klanomath While your approach is probably the quickest, easiest, and most pragmatic one, I would advise against it because I fear it might introduce issues with iCloud synchronization, which might come back to bite you when switching laptops after repairs.
    – Synoli
    Feb 23, 2017 at 18:13
  • @user3439894 The * character cannot be inside the quotation marks. What happens if you try "${CONTACTS_BASE_DIR}"/AddressBook-*.abcddb instead?
    – Synoli
    Feb 23, 2017 at 19:09
  • @user3439894 Regarding your comment on Sources: You’re correct, there’s no Sources folder in some installations (no idea why). Feel free to add your variants to the answer (once figured out) so others can benefit.
    – Synoli
    Feb 23, 2017 at 19:16
  • 1
    I have accepted the solution by @Synoli, which seems like the result of some hard work (I hope not only for me)! I changed shell to bash before each use---no big deal. If I had some expertise in sql and bash, I would have improved on the code by providing information from more of the fields available in normal use of Contacts.app. Perhaps I should have use the solution by klanomath---since I don't use iCloud, I had nothing to lose. I find it irritating that several Macos programs need backup via Export, in addition to Time Machine. Mar 4, 2017 at 8:01

You must log in to answer this question.

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