mdctl list
Print every group name, one per line.
mdctl list What it prints
One group name per line, in sidebar order.
Group names in sidebar order, one per line, with no header and no count. The output exists to be piped.
mdctl list
Home
Office
MacBook Air 13-inch (M1) An empty library prints nothing and still exits 0. That is the correct answer to “which groups are there” when there are none, and it means a loop over the output needs no special case.
Names come back the way activate wants them
Group names contain spaces, and these are the exact strings activate matches on. Quote them.
mdctl list | head -1
Home Exit codes
The same four across every command, so a script can branch on the number without knowing which command produced it.
| Code | Name | When |
|---|---|---|
| 0 | ok | The command succeeded. |
| 1 | commandFailed | The app understood the command and refused or failed it. The reason is on stderr. |
| 2 | usage | The arguments were wrong. Nothing was sent. |
| 3 | appNotRunning | No app is listening on the socket. |