Sub topic 10
Grouping contacts with groups and smart groups
This chapter assumes you can already create and edit contact cards in Contacts and add accounts in System Settings. If not, review those chapters first. Here you will learn how groups and smart groups differ, where each one lives and syncs, and how to use them for mail, export, and scripting.
Two kinds of group
Contacts offers two ways to collect cards.
- A group is a manual list. You decide who belongs, and the membership stays fixed until you change it.
- A smart group is a saved search. You define conditions, and Contacts recalculates the members every time you open it.
The main practical difference is storage. A group belongs to one account and syncs with it. A smart group is a rule stored only on your Mac. It never syncs to your iPhone or to other devices, although the contacts it matches do.
Creating and filling a group
- Open Contacts. If the sidebar is hidden, choose View > Show Groups.
- Choose File > New Group. A group named "untitled group" appears in the sidebar.
- Type a name and press Return.
- Select All Contacts, then drag cards onto the group. You can select several cards with Command-click and drag them together.
You can also select cards first and choose File > New Group From Selection. That creates the group and fills it in one step.
A few behaviors are worth knowing:
- A contact can belong to many groups. Adding it to a group does not move it or make a second copy of the card.
- Removing a card from a group does not delete the card. Select the group, select the card, and press Delete. Contacts asks whether you want to remove it from the group only. Choose Remove from Group.
- Deleting a group leaves its cards in All Contacts. Control-click the group and choose Delete Group.
- Rename a group by double-clicking its name, or Control-click it and choose Rename Group.
Groups belong to accounts
When you have several accounts, the sidebar lists each account with its groups beneath it. A group created under iCloud syncs through iCloud. A group under On My Mac exists only on this Mac. To choose where a new group goes, select the account name (or a group in that account) in the sidebar before you choose File > New Group.
Mixing sources is a common source of confusion. A group lives in one account, and you generally should not expect it to hold cards from another account. If a card seems to vanish after you drag it into a group, check which account the card and the group each belong to. Also check whether Exchange or another server account allows groups at all. Support for creating and editing groups varies by account type, so edit server-based groups in the service's own interface if Contacts refuses.
Building a smart group
- Choose File > New Smart Group.
- Name the smart group.
- Choose whether cards must match all or any of the conditions.
- Add conditions with the plus button. Each condition has a field, an operator, and a value.
- Click OK.
Typical fields include name, company, email, phone, address, birthday, notes, and membership in another group. Operators depend on the field. Text fields offer options such as "contains", "is", "begins with", and "ends with".
Some practical examples:
| Goal | Match | Conditions |
|---|---|---|
| Everyone at one company | all | Company contains "Contoso" |
| People with a work address and no phone number | all | Email contains "@contoso.com"; Phone is not set |
| Family or close friends combined | any | Group is "Family"; Group is "Close friends" |
| Upcoming birthdays in a certain month | all | Birthday is in the month you choose |
To change the rules later, Control-click the smart group and choose Edit Smart Group.
How smart groups behave
- Membership is computed, not stored. If you edit a card so it now matches, it appears in the smart group automatically. If it stops matching, it disappears.
- You cannot drag cards into a smart group. Change the card or the rules instead.
- Removing a card from a smart group is not possible in the same way as from a normal group. To make it leave, edit the card so it no longer matches, or change the rule.
- A smart group searches across your accounts, so it can combine cards from iCloud and On My Mac in one view.
- Because smart groups stay on the Mac, rebuild the rule by hand on another Mac. Writing the conditions down saves time.
Using groups with Mail
Groups are most useful when you write to many people at once.
- Control-click a group in the sidebar and choose Send Email to "Group Name". Mail opens a new message addressed to the members.
- In Mail, you can also type a group name in the To field and choose it from the suggestions, as long as Mail can see that group.
- Addresses for the members are filled in from each card. If a card has several email addresses, Contacts uses the first one it finds, so check which address is marked as preferred.
Large groups put every address in the visible To field, which exposes everyone's address to the other recipients. For a big or sensitive list, move the addresses to the Bcc field. In a new Mail message, choose Message > Bcc Address Field first, then place the group in that field.
Exporting a group
You can export just the members of a group as a vCard file:
- Select the group in the sidebar.
- Select all of its cards with Command-A.
- Choose File > Export > Export vCard.
The result is a single .vcf file holding every selected card. Smart groups export the same way, which is handy for turning a rule-based list into a file you can hand to someone else. The file contains the cards, not the group definition. Whoever imports it receives the cards but not the group.
Reading and changing groups with AppleScript
Contacts exposes groups to AppleScript. This read-only script lists the group names:
tell application "Contacts"
get name of every group
end tellTo see who is in one group, name the group:
tell application "Contacts"
get name of every person of group "Family"
end tellScripts can also write. This one creates a group and adds a person to it. Run it only against data you are happy to change, and change the person's name to match a card in your own address book:
tell application "Contacts"
set g to make new group with properties {name:"Book Club"}
set p to first person whose name is "Ada Example"
add p to g
save
end tellThe first time a script touches Contacts, macOS asks for permission. If you decline, the script fails with an error until you allow access under System Settings > Privacy & Security > Automation. Smart groups are a Contacts-app feature and you should not count on being able to create them from a script, so treat scripting as a tool for ordinary groups.
Common problems
- A group is missing on the iPhone. Check whether it is an ordinary group in an account that syncs (such as iCloud), or whether it is a smart group. Smart groups never appear on other devices.
- A group looks empty. In the sidebar, check whether you selected the right account. Also check that the cards you expect are in the same account as the group.
- A smart group has the wrong members. Open Edit Smart Group and check whether the setting is "all" or "any". This is the most common mistake, since "all" gives a narrow list and "any" a wide one.
- Duplicates after merging accounts. Use Card > Look for Duplicates before you build groups, so one person does not appear twice.
Exercise
You build a smart group called "Contoso" on your Mac with the condition Company contains "Contoso". Next day you cannot find it on your iPhone, and one coworker whose card you just edited to say "Contoso Ltd" is on the Mac list automatically. Explain both observations, and say what you would do to get a Contoso list on the iPhone.
Show answer
Smart groups are saved searches stored only on the Mac, so they do not sync to the iPhone. The coworker appears automatically because membership is recalculated from the conditions each time, and "Contoso Ltd" matches "contains Contoso". To get a list on the iPhone, create an ordinary group in an account that syncs, such as iCloud, and drag the Contoso cards into it. You can select the smart group's members with Command-A and drag them into the new group in one step.