How to get monitor EDID in OS X?
Asked Answered
H

6

13

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.

Headwind answered 2/7, 2016 at 4:29 Comment(2)
IOKit has not been bound by Xamarin (low # of requests thus low priority) (Tracking issue 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. https://mcmap.net/q/905910/-getting-unique-system-id-on-mac-using-c-monoLeek
I grabbed this from another site awhile back (it pops up on multiple sites now via google) : ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6 Should get you headed in the right way depending upon your end needsLeek
A
9

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

Arica answered 12/3, 2020 at 16:59 Comment(2)
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.Islet
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.Arica
L
3

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

Lollop answered 21/11, 2022 at 19:15 Comment(5)
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.Swathe
@Swathe 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.Lollop
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.Swathe
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: gist.github.com/varenc/4df0789257c2c3e9cc18d5f8a1b1a445 Last suggestion: You could try SwitchResX (madrau.com) and see if its "Export EDID" button works for you.Lollop
Mine just returns nulls. I am on MacOS Sonoma 14.4.1.Barometry
M
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
Meagre answered 23/10, 2019 at 18:46 Comment(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.Bolin
Annoyingly, I have three displays on my Mac, and all three of them are named "display0".Arica
M
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'
Marxism answered 19/12, 2020 at 0:15 Comment(0)
R
1
sudo ioreg -l | grep IODisplayEDID
Render answered 6/7, 2019 at 5:50 Comment(1)
Add some explanation to your answerThanhthank
S
1

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"
    }
  ]
}
Swathe answered 6/5, 2022 at 17:5 Comment(1)
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: #38156993 Apple might have changed something about ioreg which breaks the other solutions, but I can confirm mine works on 12.3.Lollop

© 2022 - 2025 — McMap. All rights reserved.