mdctl status
Print the app version, the engine state and the group list.
mdctl status What it prints
One field per line, ending with an `icloud:` line when the app has something to say about whether the library travels.
The first thing to run when something looks wrong, and the first thing to paste into a report. It changes nothing, so it is safe from a monitoring loop.
mdctl status
version: 1.6
state: active
active group: Home
groups: Home, Office, MacBook Air 13-inch (M1)
icloud: syncing, last synced 09:14
service: registered and allowed to run (macOS: enabled) The fields
version is the running app’s, not the tool’s. state is the engine: idle when nothing is
active, active when a group is applied. A field with no value prints (none) rather than an
empty string, so a transcript never leaves you wondering whether the value was blank or the line
was missing.
The icloud: line appears only when the app has something to say about sharing the library. Its
absence means sharing is off; a sentence there means it is on, and either working or explaining why
not.
The service: line is the privileged service for
displays at the login window. It exists because that service is for
a Mac with no monitor, reached over the network, where “have a look in System Settings” is advice
nobody at the far end can take. The sentence weighs the registration against your answer, so
not set up; you declined it reads as a choice and not set up, though it is switched on reads
as a fault.
mdctl status | sed -n 's/^service: //p'
not set up; you declined it (macOS: notRegistered) Where macOS has been asked but has not been answered, the line says so and names where to answer it: under Login Items in System Settings. The system’s own word for the state is repeated in brackets, unchanged, so a support transcript carries what macOS said rather than what the app made of it.
Reading it from a script
Labelled lines in a fixed order. Read them with sed, not a JSON parser, and branch on the exit
code rather than on the text.
mdctl status | sed -n 's/^active group: //p'
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. |