Create a gist now

Instantly share code, notes, and snippets.

# Create display override file to force Mac OS X to use RGB mode for Display
# see
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
displays = []
edids.each_with_index do |edid, i|
disp = { "edid_hex"=>edid, "vendorid"=>vendorids[i].to_i, "productid"=>productids[i].to_i }
# Process all displays
if displays.length > 1
puts "Found %d displays! You should only install the override file for the one which" % displays.length
puts "is giving you problems.","\n"
displays.each do |disp|
# Retrieve monitor model from EDID data
if monitor_name.empty?
monitor_name = "Display"
puts "found display '#{monitor_name}': vendorid #{disp["vendorid"]}, productid #{disp["productid"]}, EDID:\n#{disp["edid_hex"]}"
puts "Setting color support to RGB 4:4:4 only"
bytes[24] &= ~(0b11000)
puts "Number of extension blocks: #{bytes[126]}"
puts "removing extension block"
bytes = bytes[0..127]
bytes[126] = 0
bytes[127] = (0x100-(bytes[0..126].reduce(:+) % 256)) % 256
puts "Recalculated checksum: 0x%x" % bytes[127]
puts "new EDID:\n#{{|b|"%02X"%b}.join}"
Dir.mkdir("DisplayVendorID-%x" % disp["vendorid"]) rescue nil
f ="DisplayVendorID-%x/DisplayProductID-%x" % [disp["vendorid"], disp["productid"]], 'w')
f.write '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">'
f.write "
<string>#{monitor_name} - forced RGB mode (EDID override)</string>
puts "\n"
end # displays.each

Thank you very much for this. I think this somehow solved some of the problems I had with an HP 23xi IPS external monitor.


Thank you very much.. This worked perfectly with my Dell S2440L monitor on my Mac Mini (late 2012 model).


Awesome. I was getting ready to fork out for a Mac Display. Mac pro, Mavericks, Dell U2713H. Thanks


Could this work also for projectors ? The Mac often displays miserably bad compared to PCs


Thanks everyone, but I didn't create this; I just enhanced it to work with multiple displays and use the monitor name. Credit for the original script goes to Andreas Schwarz, which I discovered via Mathew Inkson's blog post.

It wouldn't hurt to try on your projector, or even a TV -- if the device supports both RGB and YPbPr, your Mac will probably display better in RGB mode.

deg0nz commented Apr 13, 2014

I have a no-name display (AMW X2210WAS) plugged to my macbook. When i run your script, there's no output in the Terminal and no folder created.

I figured out, that the output of the ioreg -l -d0 -w 0 -r -c AppleDisplay -command doesn't contain a IODisplayEDID part, which is required in your script via the "edids" variable.

Do you have any ideas for this problem?

vriesk commented Apr 25, 2014

Thanks Andrew, it saved the usability of my Asus PA279.

However, while it works fine with native resolution via miniDP-DP connection, when I connect it with HDMI cable, I get maximum resolution of 1920x1080. Is there some magic encoded in EDID that would cause this? Prior to running the script and setting the override, it was possible to achieve 2560x1440 via the HDMI cable, of course with horrible fonts.

P.S. The mere existence of this software is a complete PITA of Apple.

ralexx commented May 10, 2014

Thanks to you and the original author. This is a big help.

Zen-X commented Jun 11, 2014

Hello everyone,

this is my first post and sorry for my English.

I bought the Dell U2414H and hooked it up with my MacBook Pro Mid 2009. It has the Nvidia GeForce 9400M inside. In near future the display will be connected with a 2012 Mac mini with the Intel HD4000 inside.

My question is: how do I recognize that my setup suffers under the problem that is discussed here? By now, I can give you following details.

On the monitor side:

  • I own the revision A00
  • I use the original Display Port to Mini Display Port cable
  • When I first connected the monitor with my MacBook Pro the Display Port Mode 1.2 was automatically disabled
  • The Dell OSD menu tells me that the monitor is running with RGB input format, Mac Gamma and sRGB mode
  • For my eyes, everything looks fine

On the MacBook side:

  • I runs OS X 10.8.5
  • "About this Mac > Monitor" tells me that I'm using "Monitor: Dell U2414H"
  • "About this Mac > System > Grafik/Monitor" tells me "TV: Yes"
  • "System Preferences > Monitor > Colours > Open Profile" tells me "Colour Room: RGB"

Thank you very very much in advance,

goyal commented Dec 2, 2014

Thanks so much. This works perfectly!


After reading a lot of posts about LCD font smoothing and what not to fix blurry fonts on external monitors, this is the first thing that seems to fix it.

It even works together with a fix using SwitchResX to get HiDPI working (manually merge the plist files from switchresx and from patch-edid.rb) on my 27'' Acer B276HUL with 2560x1440 and now it finally looks acceptable.

I'm still switching between 1680x1080 and 1920x1080 HiDPI. It is not as crisp as the retina of my MBP, but of course that internal screen has a lot more pixel per inch, so I guess the remaining blurriness is my eyes being used to the retina display.

Thanks for sharing!

bdemers commented Feb 3, 2015

Worked great for my Dell U2413

jconroy commented Feb 17, 2015

Thanks! Worked for me on Yosemite with two Dell U2414H's (Connected via display port they were fine but HDMI wouldn't do RGB. Now they are both RGB)

gbaudoin commented Mar 4, 2015

Worked great for my Philips 247ELH on a Macbook Pro Retina, thanks !


Thanks much. This was the only thing that worked amongst all other solutions.

Macbook pro late 2011, 17inc, AMD on Acer B276HUL

lcat commented Apr 13, 2015
patch-edid.rb:9:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
lcat:~ lcat$ ioreg -l -w0 -d0 -r -c AppleDisplay
+-o AppleDisplay  <class AppleDisplay, id 0x10000066e, registered, matched, active, busy 0 (0 ms), retain 8>
      "IOClass" = "AppleDisplay"
      "CFBundleIdentifier" = ""
      "IOProviderClass" = "IODisplayConnect"
      "DisplayProductID" = 1815
      "IOPowerManagement" = {"CapabilityFlags"=49152,"MaxPowerState"=3,"CurrentPowerState"=3}
      "IODisplayPrefsKey" = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2/AppleIntelFramebuffer@2/display0/AppleDisplay-756e6b6e-717"
      "IODisplayParameters" = {"bgsc"={"min"=0,"max"=65536,"value"=65536},"rgsc"={"min"=0,"max"=65536,"value"=65536},"cmod"={"min"=0,"max"=4096,"value"=1},"ggsc"={"min"=0,"max"=65536,"value"=65536},"cyuv"={"min"=0,"max"=268435456,"value"=268435456},"vblm"={"min"=0,"max"=196608,"value"=65536},"gsc "={"min"=0,"max"=65536,"value"=65536},"colr"={"min"=0,"max"=18446744073709551615,"value"=257}}
      "IOProbeScore" = 2000
      "IOMatchCategory" = "IODefaultMatchCategory"
      "IODisplayConnectFlags" = <00000000>
      "DisplayVendorID" = 1970170734
      "DisplaySerialNumber" = 0


thank you! Worked well with my 2010 27" iMac and an Acer B276HUL on Yosemite. Finally!

abm0 commented Aug 3, 2015

Thanks a lot, man! I've been seeking solution for a long time and this is first solution, that worked for me.

coffy commented Oct 5, 2015

kudos! This is only 'upgrade' script I have to run every time I update OS X 👍

mmleif commented Oct 10, 2015

Thank you so much! It worked for my Samsung S27D850T, however afterward I saw the display frequency changed to 59Hz instead of 60Hz, it looked a bit strange. Is there anyway to force it to stick on 60Hz?

xteelps commented Oct 13, 2015

Despite trying all kind of solutions my Mac Mini (El Capitan) still inverts it's colours on the HDMI connected Philips LED TV.
Maybe a stupid question for the experts: Does it matter what name you give to the folder in 'Overrides'?
Furthermore: Should I copy-paste the entire text patch-edid.rb at the top of this thread from line 1 to line 67?
Thanks in advance!

jkgeyti commented Oct 16, 2015

Doesn't seem to work for me, despite working on yosemite.

With my laptop lid down, and the external display connected, a single folder is created by the script, and the display name of the monitor is correct (see below for file content). However, no folder of the same name exists in /System/Library/Displays/Contents/Resources/Overrides, and simply copying the generated folder has to there, has no effect.

I've tried various combinations of restarting with and without "rootless" mode enabled, unhooking and reseating hdmi cable, tried changing ownership of the produced folder and file to root:wheel like the rest of the folders in .../Overrides, but nothing seems to work.

I've further tried looking for files in the overrides folder containing the same vendor/productid (cat DisplayVendorID-*/* | grep 2245), but nothing's found, so it doesn't look like the display even has a current config file.

Command output

$ ruby patch-edid.rb
found display 'Philips 272P4?Lc': vendorid 16652, productid 2245, EDID:
Setting color support to RGB 4:4:4 only
Number of extension blocks: 1
removing extension block

Recalculated checksum: 0x42
new EDID:

Content of DisplayVendorID-410c/DisplayProductID-8c5

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  <string>Philips 272P4?Lc - forced RGB mode (EDID override)</string>
jkgeyti commented Oct 16, 2015

I just realised what the problem was for me. I hope this will be useful for others.

Opening the produced config file in nano showed the device name has a bunch of "unsupported" characters (<string>Philips 272P4^@^@^@�^@^WL^Oc^^^@ - forced RGB mode (EDID override)</string>). I replaced it with Philips 272P4 - forced RGB mode (EDID override), saved, unplugged and reseated the hdmi cable, and success!

Maybe it was worth adding a line to the script that strips all non-alphanumeric characters from the display name?


Is it possible that I have done something wrong? The script dosen't seems to work, even though the screen settings says otherwise?

skaermbillede 2015-10-20 kl 15 14 41

skaermbillede 2015-10-20 kl 15 18 11


I encounter this problem: The ruby script doesn't write out a folder (or file) on El Capitan 10.11.1 despite disabling SIP. The script is located in my home (~) folder. From there I execute it (e.g. 'sudo ruby patch-edid.rb') without any error message. Any ideas?


@tnavarroschroeder the file is created on the same folder you're running the script from, you have to move it after to the Override directory


Hi, I encounter the same problem as “tnavarroschroeder : The script doesn't generate anything, neither a file nor a folder. Any help here is much appreciated!


Didn't work on El Capitan Asus MS238, although settings are applied (shows up in display info). Can it be that some vendors are just not supported?

Nakilon commented Oct 28, 2015

I've generated folder with file for my Dell P2416D, moved them where I had to, chowned to root:wheel.
When I reboot, I see in monitor settings window to have the title "EDID overrided", so the file probably works, but 1920 is still the largest resolution I can choose even with Option key, while it has to support 2560.


Thanks to @jkgeyti this totally helped with Philips 272C4.

Jusung commented Nov 5, 2015

Hi, I encounter the same problem as @tnavarroschroeder and @tiny-kittyfeet : The script doesn't generate anything, neither a file nor a folder. Any help here is much appreciated!

majorsl commented Nov 18, 2015

Works great on an Acer K272HUL. For those stuck in 1920x1080 you might have to go HDMI to HDMI (Mac mini Late 2014 like me) or for a MacBook/Older mini with just Thunderbolt you'll probably need Mini DisplayPort to HDMI (no adapter in between).


You're a hero. Worked no problem with Dell U3014 on 10.10.5.

ye commented Dec 11, 2015

I have an Acer K272HUL 27inch WQHD (2560x1440) monitor and it suffered the same issue that OS X couldn't auto detect it as a monitor rather to consider it as a TV right out of the box.

This script worked wonders before (OS X Yosemite 10.10 and worked OS X El Capitan 10.11 El Capitan). After the OS X El Capitan 10.11.2, the screen degraded back to the YCbCr color space (TV mode). So I had to run this script again following the updated guide Force RGB mode in Mac OS X to fix the picture quality of an external monitor, the only real differences this time were to turn off System Integrity Protection, aka SIP, rootless mode before move the generated display profile and move it to a different path.

And it worked perfectly this time as well!
screen shot 2015-12-11 at 10 23 20 am


is it possible to patch the EDID to only use RGB limited?

I have a display that looks like this:


I am considering purchasing an Acer K272HUL, or a Dell UltraSharp U2715H. From what i have read, it would seem that both of these would require the forced rgb script to work properly. I have 2 questions. If i am using a dvi dual link to connect the monitor to the computer, will i still need to force rgb? ALSO, if i run this script would i be able to go back to an apple monitor, or is there some special thing that needs to be done to undo the changes made by the script?

nos1609 commented Feb 6, 2016

If anybody is planning using this patch in combination with pixel-clock patch one has to keep in mind, that prior using pixel-clock there is the need to remove any previous RGB patches.
Otherwise, you'll face a bootloop like this one

jgarcia commented Feb 19, 2016

I can finally the display at work 😻 , Thanks a lot for this !


I am having the same problem as tnavarroschroeder. The script does not generate anything. I am trying this on HP 21.5 IPS display and OS X El Capitan version 10.11.3

royrico commented Mar 12, 2016

Worked Great for me! Thank you

jamphel commented Mar 20, 2016

Hi, Need help here, i have connected my Macbook Pro 13in to AOC desktop, but the contents displayed on the desktop is not standard, it looks stretched, I am not able to find the folder (DisplayVendorID-****), after executing ruby patch-edid.rb command in terminal. Tried sudo open /System/Library/Displays/Overrides, however the below message is displayed again.
The file /System/Library/Displays/Overrides does not exist. I really appreciate if anybody can find a solution and share it here.


Was able to copy the monitor file in El Capitan in recovery mode, no need to switch off SIP.
Found my Samsung Syncmaster 2494HS and also displays "forced RGB mode" but the picture still looks the same.. I checked before I applied the script output, the monitor was already in RGB mode.


Hi, I encounter the same problem as @tnavarroschroeder , @tiny-kittyfeet, @narulasanam and @Jusung : The script doesn't generate anything, neither a file nor a folder.I am trying this on SUMSUNG S24D590PL display and OS X El Capitan version 10.11.3 Any help here is much appreciated!

narulasanam commented May 13, 2016 edited

I used HDMI and the picture quality is far better than VGA .

bitbut commented Jun 3, 2016

Hi, i have the same problem of @tnavarroschroeder, @tiny-kittyfeet, @narulasanam and @Jusung , anyone can help me to fix ? :)

kuchlous commented Jun 7, 2016

I have connected a retina MBP 13'' to a Dell U2414H. Even after making changes suggested above the fonts look fuzzy, certainly compared to the iMAC and the same monitor connected to a windows machine. I have verified that the correct profile is being used and that the color profile is RGB but still no luck. Anything else I can try..

Rapoli commented Jun 26, 2016

@BiggerGao @bitbut @tnavarroschroeder, @tiny-kittyfeet, @narulasanam and @Jusung
To all those having problem where no folder is created, I finally found the folder in my User folder as in /Users/[Account Username]
Seems that my terminal opens with that as default directory and so the folder was created there rather than in the root directory. Hope this helps for you too.


Hi! I also have the same problem as @tnavarroschroeder, my OSX is 10.11.4. Any help?


Isn't /Users/[Account Username] the same directory as home(~)? I tried to access it using Terminal, and it turned out to be the exactly same directory. Any hint? Thanks

Mikii67 commented Jul 26, 2016

This works fine with my Viera Panasonic TV connected to a mini display port to HDMI adapter. However, the patch does not "hold", and after a couple of reboots I have to install it again. Any suggestions or ideas why?

Thank you!

cheynewallace commented Sep 7, 2016 edited

I've used this script on a few different machines with success in the past, but im having a hard time trying to get it working with my ACER Predator XB271HU. I run the script, place the files in the right path and reboot, my machine starts and the colors look much better, how ever the resolution is off. I get a max res of 1024x768. When I try to change the resolution or force one with SwitchResX the screen goes black and I have to reboot my machine in safe mode to reset it. The only resolution it can display is 1024x768. My screen is a 1440p screen.

I remove the override, reboot and my resolution comes back but my colors and contrast suck again. So, it LOOKS like the script is working, but its doing something to the resolution options.

Does anyone know how to fix this at all?


Hello, this script has helped me wonderfully for two years on Yosemite. Now I upgraded to El Capitain 10.11.6 and reinstalling it gives me problems. The terminal gives an error after entering ruby patch-edid.rb.

Last login: Mon Sep 12 13:39:03 on console
Franss-Mac-mini:~ FransMacMini$ ruby patch-edid.rb
patch-edid.rb:1: invalid multibyte char (UTF-8)
Franss-Mac-mini:~ FransMacMini$ ruby patch-edid.rb
patch-edid.rb:9:in scan': invalid byte sequence in UTF-8 (ArgumentError) from patch-edid.rb:9:in


No file is created. Can anyone help me with this? Many thanks, Frans



I thought I would share my experience and solution now that I have been through this several times. I have even got it working on Mavericks and El Capitan.
My solution is for El Capitan. It is a combination of several things I have found on the internet. All I know is that it worked for me. Hopefully it will work for you as well. I am no fan of mucking about with security settings, but it was the only way I found that allowed me to copy the folder to the right directory. Please note that in El Capitan the folder is different to the original "recipe".

  1. Shut down the MAC
  2. Start up the MAC holding the keys Command-R until the apple appears
  3. When possible go to menu Utilities and select Terminal
  4. In the Terminal window type csrutil disable -This disables the apple protection of system files and folders (normally NOT recommended!)
  5. Reboot
  6. Download
  7. Unarchive it
  8. In the Finder, go to (using cmd-shift-G) the directory /System/Library/Displays/Contents/Resources/Overrides - (note - this is for El Capitan!)
  9. Place the entire directory you unarchived in step 6 (DisplayVendorID-410c) in the directory /System/Library/Displays/Contents/Resources/Overrides
  10. Shut down
  11. Start up the MAC holding the keys Command-R until the apple appears
  12. When possible go to menu Utilities and select Terminal
  13. In the Terminal window type csrutil enable This enables apple protection - DON'T FORGET THIS STEP!
  14. Reboot
  15. Hopefully enjoy non-inverted viewing...

I really hope I haven't forgotten anything. Please use these steps at your own risk. I am no expert. This has worked for me, that's all...


Sadly, the release version os macOS Sierra doesn't seem to work with this method @fransheemskerk. I just updated and followed your steps, but my display is still identified as a television (Acer S277HK). Any ideas?

neilcoplin commented Sep 21, 2016 edited

screen shot 2016-09-21 at 4 19 05 pm
@fjwillemsen - Check the file that it generates (inside the folder) to see if there is any malformed strings. I just went through it with Sierra and had to remove some non-standard characters from inside the XML tags to get the file to be read properly. It really doesn't matter what you change it to, as it's just the name of the monitor profile that is in that tag. Though once I did that, it follows the same instructions as above for El Capitan.


To download the script on Sierra, click the RAW button at the top right. Then highlight everything, and copy it. In terminal, type

pbaste > script

Then to run the script after you've disabled system protection, type

ruby script


@keirthomas - I followed your instructions above with Sierra and it didn't work for me. It is limiting the monitor to 1280x1024, basically half of it's resolution. Any thoughts on why this might be happening?


Everything worked util I upgraded to Sierra. Now I get the the same results as @JohnPrall.

krs013 commented Oct 27, 2016

Same as the last two comments--it works, but at half the resolution. There might be an additional setting in the bytes that gives the resolution of the screen, but the default values must have changed since Sierra. Reverting for now, but I'll keep an eye on this.


I've done this before on my old laptop and it worked perfectly. Now, after buying the new Macbook Pro with Sierra, I am getting the same issue as @johnPrall and subsequent people. If anyone finds a fix, please let us know!


Yo guys on Sierra. Fixed it. Go here: add in your monitor resolution to the generated file. Works like a charm! 👍

LockonS commented Nov 23, 2016

@DClark5218 - I followed the instructions on the page you provided. But actually nothing changed when I place the generated file in the target directory. I am using Sierra 10.12.1 and the monitor is Dell U2525H.

igorescodro commented Nov 24, 2016 edited

@LockonS - I found this another gist and it worked in macOS Sierra (MBP Late 2012) with my Dell 2317H.
Get that "patch-edid.rb" and run it in similar way of this in this gist (only external monitor connected).
Hope it work for you all!


Confirmed script works with Sierra and an ASUS MX259; followed suggestions from Marcus to not disable SIP


Sierra users - to run this ruby script please make sure that your ruby is actually working. Coming from behind 4 osx upgrades my ruby did not, so this script did not work, nor give out any meaningful errors withing 5 minutes of looping. Just type in terminal "ruby -v" to see if it respons. If not, reinstall/fix ruby and it will work.


How I can modify the script to keep the refresh rate at 144hz ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment