Skip to content

Instantly share code, notes, and snippets.

  • Save JohannesHoppe/f7a477b4660b6f4f42b6ee8356cfef0d to your computer and use it in GitHub Desktop.
Save JohannesHoppe/f7a477b4660b6f4f42b6ee8356cfef0d to your computer and use it in GitHub Desktop.
Force RGB mode in Mac OS X to fix the picture quality of an external monitor.

Force RGB mode in Mac OS X to fix the picture quality of an external monitor (Original)

Update: I have heard that 10.8.3 has solved this problem for some people, so I rolled back my changes and installed the update. No change on my monitor. Nevertheless, it’d be a good idea to update OS X before trying this, since it may fix the issues with your particular hardware.

I recently bought a MacBook Pro (with ‘Retina’ screen), but when I hooked it up to my Dell U2410 monitor via HDMI cable I was shocked by the poor picture quality. The contrast was all wrong and text was misshapen. No amount of calibration in the monitor or software would fix it.

Short answer: OS X thinks my monitor is a TV, and is using the YCbCr colour space rather than RGB. I had to override an EDID setting to force the RGB colour space, and it is now working correctly.

Long answer: I haven’t owned a Mac for a while and had forgotten how useless most of the “Apple community” is when it comes to anything that can’t be adjusted in System Preferences. Googling for problems with external monitors on MacBooks found dozens of threads on official and unofficial Apple forums, all full of people with the same problem. The most common responses from the Apple geniuses was to blame the monitor, despite assurances from the stricken users that the monitor worked beautifully in Linux and Windows, even on the same machine under Boot Camp.

“You just haven’t calibrated it!”, “You are just too used to Retina now!”, “You just need to buy a Thunderbolt display!” Apple people also like to solve problems by throwing more money at it. (I realise that owning a Mac makes me an Apple person, too. Hypocritical self-loather?)

My lucky break was reading that the current colour space was “YCbCr” when I was browsing the monitor’s settings menu. I was sure that it was using RGB when hooked up to my PC, so I started searching instead for forcing RGB mode in OS X. It didn’t appear to be available out-of-the-box, but I have had some experience in overriding EDID settings for similar purposes so I searched instead for that.

I found this thread on the EmbDev.net forums. Mr Schwarz, thanks very much. Your thread and script was incredibly helpful and informative. It was written to fix problems connecting an external monitor via DisplayPort, but it fixed my HDMI issue just the same. I’ve summarised the required steps below.

My last word is to wonder what Apple is playing at. It seems that this problem has been reported by a lot of people for a long time, and I expect it would require a fairly simple software update. Do they just not care about those using third-party components, or are they actively attempting to force people on to Thunderbolt displays?

How to force RGB in Mac OS X

  1. Download the patch-edid.rb script from the forums thread above and put it in your home directory.
  2. Connect only the external monitor(s) in question (I closed my MacBook lid, for example). The script will make override files for any connected monitor.
  3. Type “ruby patch-edid.rb” in Terminal.
  4. A new folder will be created in your home directory. Move it into the /System/Library/Displays/Overrides folder. If Finder tells you that you are overwriting an existing folder, consider backing it up first.
  5. Restart your computer, enjoy your monitor.

To undo the changes, either delete the folder you had copied to the Overrides folder (if it didn’t already exist) or replace it with the folder you had backed up.

Updates

If you’re having trouble with any of these steps, please have a look through the comments below (and note that there are multiple pages). Many questions have been answered with helpful tips from others.

Update, 27 Oct 2013: If you’ve applied this fix before, the OS X Mavericks update will overwrite it. I’ve successfully re-applied the fix by following exactly the same steps, and other commenters below have done so, too.

Update, 13 Nov 2013: Andrew comments below that he has modified the script to add some useful new features, and provides a link to his GitHub for those wishing to use it instead.

Update, 28 Nov 2013: If the process appears to work but doesn’t seem to make a difference, consider Tom’s comments below. Depending on your monitor an extra tweak may be required.

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
#
# Update 2013-06-24: added -w0 option to prevent truncated lines
require 'base64'
data=`ioreg -l -w0 -d0 -r -c AppleDisplay`
edid_hex=data.match(/IODisplayEDID.*?<([a-z0-9]+)>/i)[1]
vendorid=data.match(/DisplayVendorID.*?([0-9]+)/i)[1].to_i
productid=data.match(/DisplayProductID.*?([0-9]+)/i)[1].to_i
puts "found display: vendorid #{vendorid}, productid #{productid}, EDID:\n#{edid_hex}"
bytes=edid_hex.scan(/../).map{|x|Integer("0x#{x}")}.flatten
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
puts "Recalculated checksum: 0x%x" % bytes[127]
puts "new EDID:\n#{bytes.map{|b|"%02X"%b}.join}"
Dir.mkdir("DisplayVendorID-%x" % vendorid) rescue nil
f = File.open("DisplayVendorID-%x/DisplayProductID-%x" % [vendorid, productid], 'w')
f.write '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">'
f.write "
<dict>
<key>DisplayProductName</key>
<string>Display with forced RGB mode (EDID override)</string>
<key>IODisplayEDID</key>
<data>#{Base64.encode64(bytes.pack('C*'))}</data>
<key>DisplayVendorID</key>
<integer>#{vendorid}</integer>
<key>DisplayProductID</key>
<integer>#{productid}</integer>
</dict>
</plist>"
f.close
@brokenthorn
Copy link

Doesn't work on Big Sur. Overrides folder doesn't exist and not even with sudo can you do anything in that folder and I don't really want to disable system protection. F* Apple. Why are the most professional computers so bad at supporting plan simple things?

@JohannesHoppe
Copy link
Author

One should simply never update his Mac operating system! 😉

@nitantsoni
Copy link

Doesn't work on Big Sur. Overrides folder doesn't exist and not even with sudo can you do anything in that folder and I don't really want to disable system protection. F* Apple. Why are the most professional computers so bad at supporting plan simple things?

In BigSur, create the /Library/Displays/Contents/Resources/Overrides/ path to place the DisplayVendorID-xxxx folder in. No need to disable SIP etc

@Markhenn
Copy link

Markhenn commented May 6, 2021

Doesn't work on Big Sur. Overrides folder doesn't exist and not even with sudo can you do anything in that folder and I don't really want to disable system protection. F* Apple. Why are the most professional computers so bad at supporting plan simple things?

In BigSur, create the /Library/Displays/Contents/Resources/Overrides/ path to place the DisplayVendorID-xxxx folder in. No need to disable SIP etc

Thanks! This worked on BigSur!

Also to note, I did not have to restart the MBP. The new profile showed up the moment I lifted the lid again.

I am using a 16' MBP from 2019

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