OSX iCloud Contacts not syncing

In the last month I was plagued by a Addressbook problem on one of my macs. No matter what, only about 500 of my over 1000 contacts where syncing on my Mac Pro. I have tired many times to disable and re-enable the contacts, to export all the contacts on the only mac where my contacts were complete, empty the address book and reimporting the contacts, but with limited success. Some corrupt contact was blocking my Mac Pro form syncing.

X-MS-OL-DESIGN was a starting clue so I exported again all contacts in vcf and opened the file in a text editor to find which ones had the X-MS-OL-DESIGN property. The idea was to edit them, and remove the offending property. But first I wanted to check if this was really the cause of my problems. So every time I found a contact with the X-MS-OL-DESIGN property I copied it into a secondary iCloud account that I created years ago and deleted it from my primary account. After removing all entries with the X-MS-OL-DESIGN property, I was able to sync all remaining contacts on the Mac Pro. Moreover, by moving the offending contacts to the secondary account, the offending property was gone, and I was able to move them back in the primary account and they where synced perfectly.

You are the man!
Many many thanks for this post on cpmtacts npot syncing.
Opened v-card with textwrangler, found 2 contact with the offending x-mo-whatever. delted them. Now all is fine. Very much appreicate your post.

How to solve:
1 – make a VCF archive from iCloud
2 – grep the file for “label” like :
cat YOUR_EXPORT_FILE_NAME.vcf | grep -B11 label| grep “FN:”
3 – export these cards, one by one
4 – delete them one by one from iCloud
5 – import them into another iCloud account
6 – export them from this new iCloud account
7 – import them back into your original iCloud account, from the Web or Contacts does not matter

What worries me is that the property name “label” did not completely disappear after this giant clean up, for the same specific above contacts, and even shows up as doublons:

example:
cat YOUR_LAST_ADDRESSBOOK_EXPORT.vcf | grep -B11 label| less
….
label;charset=utf-8;type=work;type=pref: CITY\nCOUNTRY
label;charset=utf-8;type=work;type=pref: CITY\nCOUNTRY
label;charset=utf-8;type=work;type=pref: CITY\nCOUNTRY….
It’s weird to see 3 or 4 times the same “label” (always city / country by the way) whereas AddressBook only shows one city one country !

Here are some logs where “propertyName = label;” was the KEY to narrow down the problem