Removing duplicate entries in Address Book

addressbook100pxA recent tip and the comments on it on macOSXHints provide a handy summary of the options for finding and removing duplicate entries in your Address Book.

There are at least three options:

A. Address Book’s built-in ‘Look for Duplicate Entries’ Option

Select the ‘Look for Duplicate Entries…” option from the Card menu. This is less than helpful because it doesn’t give you any information about the cards it will merge. It only offers to do it, without telling you what it’s doing:

mergeduplicates

B. List duplicates with a Terminal command

The macOSXHints tip contains the text of a useful terminal command:

osascript -e 'tell app "Address Book" to get the name of every person' \
| perl -pe 's/, /\n/g' | sort | uniq -d

Type this text at the Terminal prompt (or cut and paste it, making sure that any ‘curly’ quotes are staight), and you are rewarded with a list of the offending cards (I had two) which you can resolve yourself:

terminallist

C. Run a ‘Find Duplicates’ AppleScript

In the comments to the tip you will find an AppleScript for removing duplicates. You may wish to adjust the spelling before using it.

It will trawl through your cards and add any duplicates to a new group called “Duplicate Entries” (or possible “Dupelicate Entries”).

Needless to say, you would of course make a backup of Address Book first, using the “Back up Address Book…” option in the File menu.address book, duplicates, applescript, terminal, tips

Similar Posts:

Tags: , , , ,

Leave a Reply