Previous 1 2 Next 19 Replies Latest reply: Jul 18, 2015 7:06 AM by newrom
jfaughnan Level 3 Level 3 (785 points)

My OS X Address Book started out with about 10 groups, but now has about 300 groups.


The replication arose because of a bug in how iCloud handles a mixture of Address Book Cards with both OS X and Windows line terminated Notes (LF vs. CRLF - it helps if you once used a typewriter).


I figured out how to convert Address Book to all LF terminated line feeds and I was able to get working on a different account, but my core account is stuck with 300 groups (some replicated 50 times).


I know how to delete all Cards/Contacts in Contacts, but, unfortunately that doesn't remove Groups. (Groups have an interesting behavior in iCloud, almost as though Apple has a special plan for them.)


I can delete Groups one at a time on, but that's tedious. Unfortunately deleting them on Address Book, and trusting in sync to clear up, is equally tedious.


Has anyone heard of a way to delete all Groups on iCloud or Address Book 6? Perhaps an AppleScript?


Has anyone heard of Apple resetting a corrupt iCloud account to clear out bad data? (I have a clean version of Address Book I can use to restart -- that, by the way, is harder than you'd think. Again because Groups are special).


Advice appreciated. If I get some free time I might take may laptop by the Genius bar and see what they say...

  • jfaughnan Level 3 Level 3 (785 points)

    Thank you Winston, I'm familiar with that article. It's a good one.


    In this case however, I do not have duplicate contacts, I have duplicate groups.

  • rhammock Level 1 Level 1 (0 points)

    I apologize for jumping in, as I don't have an answer -- I found this because I have the same problem. I did want to clarify something, however: If I have to hand-delete a mass of groups (not as many as yours, but 100+), I am guessing that I should change the default address book to wherever I am deleting. Currently I have the iCloud version as a default, but I can't find where to even manually delete groups there..


    I hope you get your answer -- I've subscribed to this tread just in case.

  • jacabeza Level 1 Level 1 (0 points)

    I have exactly the same problem.


    I use iClud as default in all my devices and they all show the same contacts, including the groups. I dont have duplicate contacts, but hundreds of empy groups (groups with no name). It seems that an empty group replicates several times a day. I dont know how to stop this replication process and, additionally,  I dont know how to remove hundreds of groups (apart from one at a time).


    Any help will be greatly appreciated.

  • jfaughnan Level 3 Level 3 (785 points)

    I'm sorry to say that in this case misery loves company. These reports tell me that sooner or later someone with programming chops or clout will get this bug and do something.


    In my case it's not a priority -- I've given up on iCloud and Lion both and I kept my iMac on Snow Leopard. I'm back to synchronizing my Address Book with my iPhone via iTunes cable (it still works, still is the most reliable way to sync).


    I'm going to try Mountain Lion on my MacBook Air and see if that provides any fixes, otherwise I'll wait and see if Apple fixes iCloud. I won't move my main machine to Lion, and I'll hold off going to Mountain until this bug is fixed.

  • jfaughnan Level 3 Level 3 (785 points)

    I figured this out. In this case I didn't care about my Contacts, I had them elsewhere. My problem was my iCloud acount was "poisoned" with massive replication of 'Groups'. Even after I deleted all the Contacts I still had hundreds of Groups to get rid of. Manual deletion was too tedious.


    The answer was a simple AppleScript (I'm on ML on the machine i ran this on, so it's "contacts" rather than Address Book:


    tell application "Contacts"

              repeat 50 times

                        set theGroup to group "MyGroupName"

      delete theGroup

              end repeat


    end tell


    Since I had the same Group Names replicated about 100 times each, I only had to run this about 10 times to clear them all out. When I got to smaller numbers I had to drop the repeat count. I changed the Group name as I went.


    Took me about five minutes.


    I'm sure an AppleScripter could turn this into a general script for removing all groups all at once. Or could get very clever, and only remove groups that had no contacts (so one could salvage the group/contact relationships).


    I didn't need that. My problem has been fixed.


    I think sync works a LOT better in ML than Lion btw. iCloud updated very quickly.

  • rhammock Level 1 Level 1 (0 points)

    I apologize for asking what may be an obvious question, but I've probably use Scripts once in the past decade.


    My 300+ Groups don't even have a name -- it's just a list of empty groups called "Group Name" -- Do I need to change your script to reflect something different in the quotation marks?


    Thanks for your help.



  • jfaughnan Level 3 Level 3 (785 points)

    Yep, just change it to "Group Name"

  • SDH57 Level 1 Level 1 (0 points)

    I had a similar problem (Lion OS X).  Hundreds of duplicates of 3 Groups. Was driving me nuts trying to work a way of deleting them. 


    For the record, my problem started when I created multiple tags in Cobook which syncs with Address book. These tags create Groups in Address Book.


    The script sorted it in 15 mins once I'd worked out how to use it.  Thanks jfaughnan!



  • Jon Hammersley Level 1 Level 1 (0 points)

    I have the same with duplicate groups, I have a few thousand and it's taking ages to remove them.


    I think the reason for my duplicates was becuase I have two email addresses registered with itunes and iCloud (my personall email and my .me address. This is what triggered it, however I now I have the nightmare of deleting them.

  • LWH1966 Level 1 Level 1 (0 points)



    I have run scripts in setting up OpenGL programs on my Macs.  I cannot get your script to execute, however, and have tens of thousands of "untitled group"s in my contacts in the cloud.  Does each line in the script need to be entered separately into Terminal, all in one line, or something different yet?  Please advise.



  • jfaughnan Level 3 Level 3 (785 points)

    It's to be used in AppleScript editor. Copy, paste, edit for your use, execute. Try this url:

    for a guide to this sort of action.

  • Sarah Dolk Level 2 Level 2 (390 points)

    The script works. It turns out I had over 10,000 of these untitled groups, as a result of trying to get these groups out of several devices and re-syncing over and over. Don't do that. Do this...

    1 - MUST have ALL devices set to sync the Contacts with icloud - iCloud Contacts turned on.

    2 - don't run any apps or use the internet while doing this - it really slows down the response time of everything.

    3 - run the script on your computer that has the contacts as many times as it takes until it tells you if is unable to find the groups you are trying to delete. You may have to adjust the number you are wanting to delete to a lower number when it gets close to the end. You know you are close because the script runs much faster towards the end.

    4 - give it a lot more time to sync with all  the devises - just walk away.  I went to bed and the next day all the untitled groups were gone from all devices, my computer and my iCloud account.

    This script did not run on 10.7.5, but worked fine in 10.8.3

  • Corsica76 Level 1 Level 1 (0 points)


    it is the first time I use AppleScript


    So I try to do the script, but I make mistakes


    Can you help me ?


    In Contacts, I have more than 1 500 groupes called "groupesanstitre"

    So can you tell me how to change your script to fit mine?



Previous 1 2 Next