mdctl displays
Print the displays the machine is showing.
mdctl displays What it prints
One display per line, left to right across the desk: reference, size, refresh rate, name, and [main] on the one carrying the menu bar.
What the machine is showing right now, left to right across the desk. Not what a group says it should be showing: this is the live topology.
mdctl displays
virtual:4C2E9A31-7F0B-4E58-9C1D-8A0F2B6D5E77 5120x1440 @ 60Hz Home ultrawide [main]
physical:A1B2C3D4-5E6F-4071-8293-A4B5C6D7E8F9 3840x2160 (7680x4320 px) @ 60Hz Studio Display The reference column comes first because the next command needs it
Everything else on the line is for recognising the display; the reference is what you paste into
edid or protect. It is the same spelling the configuration file uses, so a display you can see
here is one you can find in the file.
A display the app created is named through its own spec rather than through the ColorSync UUID CoreGraphics hands out for every display, ours included. Two spellings of one reference, with the tool printing the one you could not use, was a real bug.
Points and pixels
The size is in points, and the pixel size follows in brackets only when the two differ. On an ordinary display printing both would be noise; on a HiDPI display the difference is the whole point.
mdctl displays | wc -l
2 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. |