Joel Barsotti
Joel Barsotti

Reputation: 3089

How to get monitor EDID in OS X?

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.

Upvotes: 14

Views: 17708

Answers (6)

Synchro
Synchro

Reputation: 37710

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"
    }
  ]
}

Upvotes: 2

Chris
Chris

Reputation: 3344

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

Upvotes: 3

KTane
KTane

Reputation: 21

sudo ioreg -l | grep IODisplayEDID

Upvotes: 1

startergo
startergo

Reputation: 21

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'

Upvotes: 2

Edward Falk
Edward Falk

Reputation: 10063

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

Upvotes: 9

Steven
Steven

Reputation: 456

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

Upvotes: 2

Related Questions