2

This question already has an answer here:

Because of some unknown problems, I have hundreds of empty contacts group,I want to delete them all.

I try it on Mac and iCloud,they can just delete one group a time.

I haven’t found any good apps to do it in App Store,if you know one,please tell me.

marked as duplicate by grg Jan 30 '18 at 10:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

It's been a while, and I'm afraid I don't have the actual script anymore, but when I had a similar problem I ended up using AppleScript.

I first found this solution (https://discussions.apple.com/thread/4088851) then tailored it to my needs with this answer on Stack (AppleScript to compare contacts in two groups and remove duplicate from one group).

If I remember correctly, however, I backed up the few contact groups I wanted to saved and manually re-entered them after, leaving the script to be quite simple and just delete everything.

Have a stab at that and if you get stuck, I suggest posting on https://stackoverflow.com for some specific script advice.

2

Thanks Leonard Challis, I finally solved this problem with AppleScript.

I found the script here. Script to delete all groups in contacts

Just copy the code to "Script Editor" and run it.

set counter to 0
display dialog "Name of group to delete?" default answer ""
set theGroupName to text returned of result
tell application "Contacts"
    repeat
        try
            set theGroup to group theGroupName
            delete theGroup
            set counter to counter + 1
        on error
            exit repeat
        end try
    end repeat
    save
    display dialog "Removed " & counter & " instances of the group" with icon caution buttons {"OK"} default button "OK"
end tell

It will run a very long time if you have a lot of groups, just wait, it's working.

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