12

I'm looking to pull the EDID information in OS X / macOS?

It looks like it's stored in the IORegistry. Is there a way to access it with the current monomac libraries? Can I do it with standard interop or do I need to write a custom shim?

It looks like the ioreg command line can also get to IODisplay EDID attribute, but there doesn't seem to be an easy way to get an abbreviated list of devices.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Joel Barsotti
  • 3,031
  • 7
  • 35
  • 59
  • `IOKit` has not been bound by Xamarin (low # of requests thus low priority) (Tracking issue https://bugzilla.xamarin.com/show_bug.cgi?id=28503), While I have done a some bindings, I find it WAY faster to just do a shell and use `ioreg` and parse the info you need i.e. http://stackoverflow.com/a/31716044/4984832 – SushiHangover Jul 02 '16 at 04:49
  • 2
    I grabbed this from another site awhile back (it pops up on multiple sites now via google) : `ioreg -lw0 | grep IODisplayEDID | sed "/[^<]* – SushiHangover Jul 02 '16 at 05:01

6 Answers6

8

Sadly, there's no out-of-the box solution.

First, what you want to do is download the "edid-decode" program. Unfortunately, it's not available via homebrew so you'll have to download it from https://git.linuxtv.org/edid-decode.git/ or https://github.com/timvideos/edid-decode. Luckily, it's just a single .c file, so you only need to type "make". (Don't do "make install" without editing the bindir and mandir in the Makefile). Put the resulting binary in your path.

Then execute ioreg -lw0 -r -c "IODisplayConnect" -d 2 | grep IODisplayEDID (kudos to @Steven) to get the EDID data in hex form for all of your monitors.

Select one of your outputs, copy the hex string to the clipboard, and then execute pbpaste | edid-decode

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
  • 1
    Perfect - amazingly useful information. A heads up to anyone worried about having to compile `edid-decode` - just download the repository as a zip, extract, enter the resulting directory in terminal and type 'make'. That's all there is to it. – WillyC May 22 '20 at 22:32
  • 2
    Just adding on: you will need to have a compiler on your system. If not, install xcode first, or find a friend to compile it for you. – Edward Falk Aug 17 '20 at 17:43
2

If you want to check EDID text, try

ioreg -lw0 -r -c "IODisplayConnect" -n "display0" -d 2 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
Steven
  • 468
  • 4
  • 14
  • 2
    A bit of explanation would make this answer much more useful. Just throwing in a command line, that does not even answer the question (not only the question title) is hardly helping the OP. or someone else to gain some insight. – trapicki Jan 21 '20 at 12:28
  • Annoyingly, I have three displays on my Mac, and all three of them are named "display0". – Edward Falk Mar 12 '20 at 16:46
2
for theedid in $(ioreg -lw0 -r -c "IODisplayConnect" -d 2 | grep IODisplayEDID | sed -E "/^.*<(.*)>/s//\1/"); do edid-decode <<< $theedid; done

anything that looks like edid:

for theedid in $(ioreg -lw0 | grep '<00ffffffffffff' | sed -E "/^.*<(.*)>/s//\1/"); do edid-decode <<< $theedid; done

or:

ioreg -lrw0 -c "IODisplayConnect" -d2 | sed -nE '/^.*"IODisplayEDID" = <(.*)>/s//edid-decode <<< \1/p'
pkamb
  • 33,281
  • 23
  • 160
  • 191
startergo
  • 21
  • 3
2

Simpler solution for recent macOSes:

system_profiler -json SPDisplaysDataType  | jq -r '.SPDisplaysDataType[0].spdisplays_ndrvs[]._spdisplays_edid'

That'll extract the EDID in hex format for monitors on the first GPU. Change the index ("[0]") to [1] or [2], etc, to get it for other GPUs/monitors. Or just drop jq and copy+paste the hex EDID found in the detailed output:

system_profiler -json SPDisplaysDataType

The solutions that rely on ioreg all work, but parsing its output is a pain and could break in the future. Apple doesn't document it, but when system_profiler is used with the -json or -xml flags it outputs far more information. Including the edid which we care about.

note: the -json flag on system_profiler is relatively new. If you don't have the -json flag you can use -xml instead though then you can't use jq to parse the output: system_profiler -xml SPDisplaysDataType

Synchro
  • 35,538
  • 15
  • 81
  • 104
Chris
  • 3,184
  • 4
  • 26
  • 24
  • `jq` isn't available by default, but homebrew has it. The first of those gives me `null, null`, and the JSON output in the second doesn't contain any `_spdisplays_edid` properties at all. – Synchro Nov 22 '22 at 06:56
  • @Synchro My `[0]` index is probably wrong for you. It depends on your GPU order and which monitor is using which GPU. Though does `system_profiler -json SPDisplaysDataType | grep -i edid` just return nothing for you? If so, is there anything peculiar about your monitor setup? I'm surprised you can't find an EDID in either `ioreg -l | grep "IODisplayEDID"` or `system_profiler`! You could also try `system_profiler -xml SPDisplaysDataType | grep -i -A1 _edid` to make sure that doesn't work. – Chris Nov 22 '22 at 22:55
  • It's a Mac Studio, so I only have one GPU, and it's definitely index 0. I've added the full output to my answer; as you can see, there is no EDID, but you can see that my monitors have duplicate serial numbers. – Synchro Nov 23 '22 at 08:32
  • Interesting! Sorry I can't be of much help. Surprised it's not in this or `ioreg`. Maybe macOS just doesn't output EDID data for Apple GPUs or in certain situations. Like I notice on my output it seems to say it's using DisplayPort to talk to my MBP screen and that `spdisplays_vendor` is `Intel`, whereas yours is `sppci_vendor_Apple` and no mention of DisplayPort for you. Here's my output for comparison: https://gist.github.com/varenc/4df0789257c2c3e9cc18d5f8a1b1a445 Last suggestion: You could try SwitchResX (https://www.madrau.com/) and see if its "Export EDID" button works for you. – Chris Nov 24 '22 at 00:27
1
sudo ioreg -l | grep IODisplayEDID
pkamb
  • 33,281
  • 23
  • 160
  • 191
KTane
  • 21
  • 1
0

Building on @KTane's answer, that snippet didn't show anything, but this does (macOS Monterey 12.3 on a Mac Studio):

ioreg -l | grep EDID
    | |   |   |   "DisplayAttributes" = {"SupportsSuspend"=No,"MaximumRefreshRate"=144,"SupportsActiveOff"=No,"PortID"=32,"ProductAttributes"={"ManufacturerID"="SAM","YearOfManufacture"=2018,"SerialNumber"=810889805,"ProductName"="C27JG5x","AlphanumericSerialNumber"="HTOKC02346","LegacyManufacturerID"=19501,"ProductID"=3928,"WeekOfManufacture"=51},"MaxVerticalImageSize"=34,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44352,"Y"=20736},"Green"={"X"=18048,"Y"=43328},"Blue"={"X"=9984,"Y"=4032}},"DefaultColorSpaceIsSRGB"=No,"NativeFormatHorizontalPixels"=2560,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"NativeFormatVerticalPixels"=1440}

    | |   |   |   "EDID UUID" = "4C2D580F-0000-0000-331C-0104A53C2278"

    | |   |   |   "DisplayAttributes" = {"SupportsSuspend"=No,"MaximumRefreshRate"=144,"SupportsActiveOff"=No,"PortID"=48,"ProductAttributes"={"ManufacturerID"="SAM","YearOfManufacture"=2018,"SerialNumber"=810889805,"ProductName"="C27JG5x","AlphanumericSerialNumber"="HTOKC02337","LegacyManufacturerID"=19501,"ProductID"=3928,"WeekOfManufacture"=51},"MaxVerticalImageSize"=34,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44352,"Y"=20736},"Green"={"X"=18048,"Y"=43328},"Blue"={"X"=9984,"Y"=4032}},"DefaultColorSpaceIsSRGB"=No,"NativeFormatHorizontalPixels"=2560,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"NativeFormatVerticalPixels"=1440}

    | |   |   |   "EDID UUID" = "4C2D580F-0000-0000-331C-0104A53C2278"

Can you spot the problem? Yes, both my monitors have the same serial number and UUID. Samsung needs a slap...

Update:

Here's the full output of system_profiler -json SPDisplaysDataType:

{
  "SPDisplaysDataType" : [
    {
      "_name" : "Apple M1 Max",
      "spdisplays_mtlgpufamilysupport" : "spdisplays_metal3",
      "spdisplays_ndrvs" : [
        {
          "_name" : "C27JG5x",
          "_spdisplays_display-product-id" : "f58",
          "_spdisplays_display-serial-number" : "3055324d",
          "_spdisplays_display-vendor-id" : "4c2d",
          "_spdisplays_display-week" : "51",
          "_spdisplays_display-year" : "2018",
          "_spdisplays_displayID" : "4",
          "_spdisplays_pixels" : "2560 x 1440",
          "_spdisplays_resolution" : "2560 x 1440 @ 144.00Hz",
          "spdisplays_main" : "spdisplays_yes",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_online" : "spdisplays_yes",
          "spdisplays_pixelresolution" : "spdisplays_qhd",
          "spdisplays_resolution" : "2560 x 1440 @ 144.00Hz",
          "spdisplays_rotation" : "spdisplays_supported"
        },
        {
          "_name" : "C27JG5x",
          "_spdisplays_display-product-id" : "f58",
          "_spdisplays_display-serial-number" : "3055324d",
          "_spdisplays_display-vendor-id" : "4c2d",
          "_spdisplays_display-week" : "51",
          "_spdisplays_display-year" : "2018",
          "_spdisplays_displayID" : "3",
          "_spdisplays_pixels" : "2560 x 1440",
          "_spdisplays_resolution" : "2560 x 1440 @ 144.00Hz",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_online" : "spdisplays_yes",
          "spdisplays_pixelresolution" : "spdisplays_qhd",
          "spdisplays_resolution" : "2560 x 1440 @ 144.00Hz",
          "spdisplays_rotation" : "spdisplays_supported"
        }
      ],
      "spdisplays_vendor" : "sppci_vendor_Apple",
      "sppci_bus" : "spdisplays_builtin",
      "sppci_cores" : "24",
      "sppci_device_type" : "spdisplays_gpu",
      "sppci_model" : "Apple M1 Max"
    }
  ]
}
Synchro
  • 35,538
  • 15
  • 81
  • 104
  • Your example doesn't include the actual EDID information in it. As in, there's nothing to parse with `edid-decoder`, etc. That said, you can check if the solution I just posted works: https://stackoverflow.com/questions/38156493/how-to-get-monitor-edid-in-os-x/74523869#74523869 Apple might have changed something about `ioreg` which breaks the other solutions, but I can confirm mine works on 12.3. – Chris Nov 21 '22 at 19:21