Skip to content

Instantly share code, notes, and snippets.

@GetVladimir
Last active December 26, 2024 09:43
Show Gist options
  • Save GetVladimir/c89a26df1806001543bef4c8d90cc2f8 to your computer and use it in GitHub Desktop.
Save GetVladimir/c89a26df1806001543bef4c8d90cc2f8 to your computer and use it in GitHub Desktop.
Force RGB Color on M1 Mac

Force RGB Color on M1 Mac

How to Force RGB Color Output instead of YPbPr on your M1 Apple Silicon Mac for an External Monitor.

This step-by-step video tutorial will guide you through the procedure of forcing RGB color output on your M1 Mac.

Force RGB Color on M1 Mac

Here is the direct link to the video tutorial: https://www.youtube.com/watch?v=Z1EqH3fd0V4

The video also has Closed Captions (Subtitles) that you can enable, to make it easier to follow if needed.



Please note that you're doing any changes on your own risk.

Terminal commands used in the video

Here are each of the Terminal commands mentioned in the tutorial, so that you can just copy and paste them:

open /Library/Preferences

plutil -convert xml1

plutil -convert binary1

plutil -lint



The step-by-step procedure on how to force RGB Color Output on M1 and M2 based Macs with Terminal commands

  1. Open Terminal and use this command to make Finder select the displays plist file:
    open -R /Library/Preferences/com.apple.windowserver.displays.plist

  2. Drag and drop the com.apple.windowserver.displays.plist file to Desktop manually. Don't use the cp command, as it won't add your current user with writing privileges.

  3. Convert the file to XML:
    plutil -convert xml1 ~/Desktop/com.apple.windowserver.displays.plist

  4. Open the converted file with the default plain text editor (avoid using the built-in TextEdit app if possible, since it might modify the file and make it unreadable by the system)
    open -t ~/Desktop/com.apple.windowserver.displays.plist
    or
    open -a CotEditor.app ~/Desktop/com.apple.windowserver.displays.plist

  5. Copy and paste the missing LinkDesription Key under the current display (check the screenshot below for an example of how it should look like):

				<key>LinkDescription</key>
				<dict>
					<key>BitDepth</key>
					<integer>8</integer>
					<key>EOTF</key>
					<integer>0</integer>
					<key>PixelEncoding</key>
					<integer>0</integer>
					<key>Range</key>
					<integer>1</integer>
				</dict>
  1. Save the file and then convert it to binary again:
    plutil -convert binary1 ~/Desktop/com.apple.windowserver.displays.plist

  2. Check if the plist file is valid:
    plutil -lint ~/Desktop/com.apple.windowserver.displays.plist

  3. Open the /Library/Preferences/ folder again:
    open /Library/Preferences/

  4. Drag and drop the updated com.apple.windowserver.displays.plist file from Desktop to the Library folder manually. Don't use the cp command, as it won't add your current user with writing privileges.

  5. Right Click on the com.apple.windowserver.displays.plist file in the Library folder and click on Get Info

  6. Check the boxes for Stationery and Locked.

  7. Reboot the Mac.

That's it!



(Alternative) Terminal commands to force RGB Color Output on M1 and M2 based Macs and workaround for losing RGB color after waking up from sleep

  1. Open Terminal

  2. Paste the following commands to edit the User's displays plist file com.apple.windowserver.displays.[UUID].plist using the built-in PlistBuddy function in macOS:

/usr/libexec/PlistBuddy -c "add DisplaySets:Configs:DisplayConfig:DisplayConfig:DisplayConfig:LinkDescription:BitDepth integer" ~/Library/Preferences/ByHost/com.apple.windowserver.displays.*.plist
/usr/libexec/PlistBuddy -c "set DisplaySets:Configs:DisplayConfig:DisplayConfig:DisplayConfig:LinkDescription:BitDepth 8" ~/Library/Preferences/ByHost/com.apple.windowserver.displays.*.plist
/usr/libexec/PlistBuddy -c "add DisplaySets:Configs:DisplayConfig:DisplayConfig:DisplayConfig:LinkDescription:EOTF integer" ~/Library/Preferences/ByHost/com.apple.windowserver.displays.*.plist
/usr/libexec/PlistBuddy -c "add DisplaySets:Configs:DisplayConfig:DisplayConfig:DisplayConfig:LinkDescription:PixelEncoding integer" ~/Library/Preferences/ByHost/com.apple.windowserver.displays.*.plist
/usr/libexec/PlistBuddy -c "add DisplaySets:Configs:DisplayConfig:DisplayConfig:DisplayConfig:LinkDescription:Range integer" ~/Library/Preferences/ByHost/com.apple.windowserver.displays.*.plist
  1. Reboot your Mac

(Workaround) If your Mac loses RGB color after waking up from sleep mode, either Reboot your Mac (recommended) or use this Terminal command to stop the WindowServer and login again (not recommended):

sudo killall -HUP WindowServer



End result

The end result is having your M1 mac output RGB color to your external monitor instead of YPbPr, potentially making the colors more accurate and the text a bit more crisp, even on older 1080p monitors.

Hopefully this tutorial would be useful to someone.

Please feel free to ask in the comment section if you have any questions regarding this procedure.



Background

While doing a lot of testing on how the Dual-Cable workaround makes RGB to work on M1, I've discovered what changes it makes to macOS, and managed to create a more streamlined workaround without the need to use a second cable.

To make things easier, I've created a step-by-step video tutorial of the whole procedure that should force RGB color output on your M1 Mac connected to an external monitor, and works on an HDMI-to-HDMI cable connection.

Credits

Big thanks goes to the amazing community and all their help over the years to solve issues like this:
https://gist.github.com/ejdyksen/8302862
https://gist.github.com/adaugherity/7435890

Useful Sources

Apple Open Source Project Files for Displays and Graphics
https://opensource.apple.com/source/IOKitUser/IOKitUser-1445.60.1/graphics.subproj/IODisplayLib.c
https://opensource.apple.com/source/IOGraphics/IOGraphics-517.17/IOGraphicsFamily/IOFramebuffer.cpp.auto.html

How to Edit and Convert binary plist files
http://hints.macworld.com/article.php?story=20050803111126899
https://apple.stackexchange.com/questions/155393/how-to-beautify-binary-dict-files
https://discussions.apple.com/thread/1768480

How to Edit plist files using defaults and PlistBuddy
https://ss64.com/osx/defaults.html
https://github.com/mathiasbynens/dotfiles/blob/master/.macos

Apps based on this method

@sudowork has created an awesome script written in Phyton that automates the steps and checks for duplicate files.
You can find more info about it here: https://github.com/sudowork/fix_m1_rgb

@dangh has created an alernative script for fishshell.
You can find more info about it here: https://github.com/dangh/force-rgb.fish

@GetVladimir I've also created a Shortcut to Force RGB Color Output using the built-in Shortcuts app.
You can find how to create the Shortcut here: https://gist.github.com/GetVladimir/c89a26df1806001543bef4c8d90cc2f8?permalink_comment_id=4531552#gistcomment-4531552

@entropyconquers has created a script based on this method written in Phyton that automates the steps, makes a backup and checks for duplicate files.
You can find more info about it here: https://github.com/entropyconquers/Force-RGB-Color-on-M1-M2-Mac-Script

Additional notes

Multiple PixelEncoding and Range keys in the same plist file
Note that there might be multiple instances of the PixelEncoding and Range keys in the same file, one for each output of your monitor and for different AirPlay devices. You might need to update the integer on each one to get RGB color output on all displays.

Getting RGB color only before login
There might be multiple duplicate plist files with the same name in different locations.

Make sure that you only have the main modified file in:
/Library/Preferences

Then make a backup and remove duplicate displays plist files from these locations (if any):
~/Library/Preferences
or
/Users/username/Library/Preferences
and
/Users/username/Library/Preferences/ByHost


Please note that you'll need to have administrator privileges in order to modify the file in /Library/Preferences. Thanks goes to @keegandent and @StrategicalIT for pointing this out.

Updates regarding macOS Monterey

USB-C to DisplayPort
From what I've seen, it seems that macOS Monterey 12.0.1 finally outputs RGB color by default on some monitors when using USB-C to DisplayPort cable on M1 Apple Silicone Macs.

You might need to make a backup and delete these 2 files:
/Library/Preferences/com.apple.windowserver.displays.plist
and
/Users/yourname/Library/Preferences/ByHost/com.apple.windowserver.displays.[UDID].plist

Restart your Mac and it should properly output RGB color on the monitor on the next boot.

HDMI to HDMI
The situation with HDMI seems to got a bit more complicated. Now the whole section for the LinkDescription might be missing from the com.apple.windowserver.displays.plist on a clean install and doesn't seem to be recreated when rotating the screen either.

Luckily, the solution still works, but you might need to manually add this whole section in the displays plist file:

					<key>LinkDescription</key>
					<dict>
						<key>BitDepth</key>
						<integer>8</integer>
						<key>EOTF</key>
						<integer>0</integer>
						<key>PixelEncoding</key>
						<integer>0</integer>
						<key>Range</key>
						<integer>1</integer>
					</dict>



The section usually goes right under the CurrentInfo key, and it should look something like this:

pixelencoding

This should get your RGB color output working on M1 Mac mini, even when connected with HDMI to HDMI cable.

Multiple monitors when one them is using HDMI to HDMI
Additional thanks goes to @somogyi-ede who tested this with multiple monitors and confirmed that the LinkDescription key needs to be added under each monitor instance in order for all of them to receive RGB color output. Link to the comment

Updates regarding macOS 13 Ventura

USB-C to DisplayPort
The macOS 13 Ventura beta seems to outputs RGB color by default on some monitors when using USB-C to DisplayPort cable on M1 Apple Silicone Macs.

You might need to make a backup and delete these 2 files:
/Library/Preferences/com.apple.windowserver.displays.plist
and
/Users/yourname/Library/Preferences/ByHost/com.apple.windowserver.displays.[UDID].plist

Restart your Mac and it should properly output RGB color on the monitor on the next boot.

HDMI to HDMI
Similar as macOS Monterey, the situation with HDMI on macOS Venturs seems a bit more complicated. Usually the whole section for the LinkDescription might be missing from the com.apple.windowserver.displays.plist on a clean install and doesn't seem to be recreated when rotating the screen either.

Luckily, the solution still works, and you still need to manually add this whole section in the displays plist file:

					<key>LinkDescription</key>
					<dict>
						<key>BitDepth</key>
						<integer>8</integer>
						<key>EOTF</key>
						<integer>0</integer>
						<key>PixelEncoding</key>
						<integer>0</integer>
						<key>Range</key>
						<integer>1</integer>
					</dict>



The section usually goes right under the CurrentInfo key, and it should look something like this:

pixelencoding

This should get your RGB color output working on M1 Mac mini, even when connected with HDMI to HDMI cable.

(Optional) Lock the plist file and set it as stationary
After the macOS Ventura 13.3 update, the plist file seems to get overwritten on reboot.

After you make the edits in the file, you can try setting the file /Library/Preferences/com.apple.windowserver.displays.plist as Stationery pad and Locked, so that it doesn't get overwritten on every reboot

Stationery Pad Locked

To do this, right click on the plist file, click on Get Info and check the boxes next to Stationery pad and Locked

This requires further testing and might cause some issues, like not being able to remember new resolutions or display settings. Please note that you're making any changes at your own risk.

Updates regarding macOS 14 Sonoma Beta

USB-C to DisplayPort
The macOS 14 Sonoma seems to outputs RGB color by default when using USB-C to DisplayPort cable.

HDMI to HDMI
The macOS 14 Sonoma seems to outputs YCbCr color by default when using HDMI to HDMI cable.

  • Forcing RGB Color Output still seems to work with the original procedure of modifying the plist files

  • Modifying the display plist files still works with the alternative version

  • After the plist files are modified, putting the Mac to sleep and waking it, it seem to keep the RGB Color output (this seems to be fixed at least on a M1 Mac mini)

If you have any additional questions, please feel free to contact me.

@GetVladimir
Copy link
Author

@m1norgb thank you for the update and for the details.

I'm not sure whether or not the dock will solve the issue. Let us know how it goes

@m1norgb
Copy link

m1norgb commented Oct 25, 2022

@GetVladimir I'll report back on the dock. If it doesn't solve the problem I'm going to send it back.

I just hope that Apple will soon fix this bug. Apparently it's been reported to Apple already more than a year ago.

I also wonder whether the Apple Studio Display does have this issue as well?

@gavingt
Copy link

gavingt commented Oct 30, 2022

I'm on Ventura. I've tried everything recommended here, deleting all possible duplicate plist files. I've also done a search that includes system files and found no other duplicates.

My Dell S3221QS monitor correctly displays in RGB mode at the MacOS login screen, but as soon as I log in it switches back to YPbPr. The /Library/Preferences/com.apple.windowserver.displays.plist file gets overwritten at login time.

EDIT: I got it working! The key was not to delete the ByHosts version of the file, but to modify it in the same way as the Library/Preferences file.

@GetVladimir
Copy link
Author

@gavingt Thank you so much for your comment and for the updated solution! I'm glad to hear that you got RGB color output working

@m1norgb
Copy link

m1norgb commented Oct 30, 2022

@gavingt : Is it still in RGB mode when you put your Mac to sleep and wake it again? That's where it switches back to YPbPr for me.

@GetVladimir
Copy link
Author

GetVladimir commented Oct 30, 2022

@gavingt Yes, for me on M1 Mac mini it keeps it RGB after going to sleep and wake up.

However, other users have reported that on MacBook and on Ventura 13.0 it might revert back to YPbPr after waking up.

A real fix need to be added in future Ventura updates.

A suggested workaround was either to prevent the Mac from going to sleep when the display goes to sleep, or to lock only the displays plist file in ByHost from editing, but I haven't tested this myself and I can't recommend it.

Locking it might cause issues, so please note that you'll be doing any changes fully at your own risk.

@gavingt
Copy link

gavingt commented Oct 30, 2022

@m1norgb Unfortunately, it did revert to YPbPr upon waking from sleep.

@xilopaint
Copy link

Hey @GetVladimir, I'm thinking about purchasing this monitor. Could you tell me if I would have any problem getting it to work on macOS Ventura?

@GetVladimir
Copy link
Author

@xilopaint thank you for your question.

From what I could find from the LC49RG90SSLXZD model number, it seems to be an Ultrawide 1440p resolution 144Hz monitor.

While this resolution might be great for gaming, it's very likely for macOS to have scaling, font clarity and refresh issues with it.

However, this is just based on the technical specifications I could find. I haven't used or tested this monitor myself, so I can't really tell how well it will work

@xilopaint
Copy link

@GetVladimir thanks for your fast reply! As you understand I would need this "Force RGB" hack to make it working on macOS Ventura and the new MacBook Pro M2?

@GetVladimir
Copy link
Author

@xilopaint you're very welcome, glad if it helps.

Yes, you will need that if you use HDMI-to-HDMI connection or a dock/adapter.

If you use an USB-C to DisplayPort cable, you might not need to make any modifications

@xilopaint
Copy link

xilopaint commented Nov 2, 2022

@GetVladimir my MacBook Pro M2 doesn't have HDMI ports, only two thunderbolt/USB-C ports so I have this hub. Will I need the hack if I use it with a HDMI cable?

@GetVladimir
Copy link
Author

@xilopaint Yes, if you use HDMI and a dock, it's very likely M2 will not recognize it properly and you'll need to force RGB color output manually

@xilopaint
Copy link

@GetVladimir the reason why I need a big monitor is for day trading (good resolution to avoid eye strain and more space for multiple charts) so before purchasing such a pricey monitor I just want to make sure I won't have any big issues with my M2 Mac that I can't fix. What's your opinion?

@GetVladimir
Copy link
Author

@xilopaint If static text is important to you, you're probably better off looking for a 4K resolution monitor that can scale properly with HiDPI.

As to which specific monitor to recommend, it would be better to ask other users or check reputable online reviews that have personal experience with them.

@xilopaint
Copy link

@GetVladimir at the moment I have two old 23" 1920 x 1080 @ 60 Hz monitors. Do you think the text will look worse in this pricey 49" 5,120 x 1,440 @ 120 Hz than it looks in my old monitors?

@GetVladimir
Copy link
Author

@xilopaint I don't really know that. Could be if it doesn't scale right. It's best to try it in store first if possible

@xilopaint
Copy link

@xilopaint I don't really know that. Could be if it doesn't scale right. It's best to try it in store first if possible

@GetVladimir unfortunately it's not possible as I found the monitor in an online promotion on Samsung website.

Could you just tell me if this 3 min video proves the monitor will scale properly on macOS and I won't have problems with the text looking?

Sorry for bugging btw, I'm just planing to take advantage of a nice promotion that ends today.

@ChangHyun-Yoo
Copy link

I'm now using Mac mini(M1) and One 4K monitor with USB-C to C and other one 4K monitor with HDMI to HDMI,
before update to Ventura, I can get RGB with HDMI to HDMI thanks to this write.

But after update to Ventura, I tried all PixelEncoding to 0 and all Range to 1 and even Preferences, ByHost.
But only YPbPr shown

How can i overcome this problem..?

@GetVladimir
Copy link
Author

@ChangHyun-Yoo thank you for your comment and for the details.

Other users also reported similar issue on Ventura 13.0 when using 2 monitors and when waking up from sleep.

There seems to be some bugs in macOS Ventura 13.0.

If possible, please make a backup of the working plist and try it again on Ventura 13.1 when it's released

@GetVladimir
Copy link
Author

@xilopaint If you can't try it and can't find other users/reviews with that specific model, it's best not to buy it. Seems like looking for trouble. The choice and risk is ofcourse yours

@xilopaint
Copy link

@GetVladimir in my country we have a 7-day guarantee to cancel any purchase made online and return the product. I just asked if the YouTube video I linked seems to address the scaling issue you talked about. I have very poor knowledge about displays. :(

@somogyi-ede
Copy link

somogyi-ede commented Nov 15, 2022

Hello @GetVladimir, once again I confirm that the solution for macOS Ventura works, tested on two separate Dell monitors, one HDMI and one USB-C. Kudos and thank you!

@GetVladimir
Copy link
Author

@somogyi-ede Thank you so much for testing this and for the confirmation that it works on macOS Ventura too!

@jackson-57
Copy link

jackson-57 commented Nov 16, 2022

I may be wrong, but it seems as if the issue might be properly fixed in the latest macOS Ventura patch (as in, no workarounds needed). I tried plugging my laptop into a DVI monitor I've never used before and it worked immediately. I tried two more HDMI monitors (one of which I had modified the plist for) and RGB mode seemed to persist across display setting changes.

@GetVladimir
Copy link
Author

GetVladimir commented Nov 16, 2022

@jackson-57 Thank you so much for the update.

From my testing, I did a clean install on Ventura 13.0 and updated to 13.0.1, but the issue with HDMI doesn't seem to be fixed. It still requires the displays plist modifications.

That being said, DVI only seems to support RGB color, so it might be forcing the Mac to output properly to it.

When you connected the Mac again after the DVI to an HDMI monitor, you might have achieved the Dual-cable method to Force RGB Color on M1 Mac described here: https://gist.github.com/GetVladimir/ed6b7daa09b1092608fee82fd0559098

Let me know if that is the case

@jackson-57
Copy link

I'm not exactly sure what's going on, but I don't think the dual-cable workaround is at play. I only had one external display connected at a time to my MacBook Air, and whether or not I unplugged my USB-C hub between tests didn't seem to change anything.

I deleted the plist files and restarted, and tested everything again. It seems to always work on my 1080p HDMI monitor, but not on my 4K HDMI monitor. If I set the 4K monitor to 30hz, it uses RGB mode. I then retested the plist workaround (which thankfully is working again), so I imagine the reason the 4K monitor worked initially was that I had the plist modified. As for why my 1080p monitor works, I have no idea, maybe it uses DVI internally?

I know that previously, one DVI monitor I tested refused to work at all on 13.0 unless I messed with the plist, which got promptly reverted the moment the machine went to sleep. I haven't had the opportunity to test with that monitor on 13.0.1. My other DVI monitor seems to work perfectly, but I don't know if it worked on 13.0, because I never tested it. I'll have to check tomorrow whether both DVI monitors are working properly on 13.0.1.

Thank you for looking into this. It's definitely a confusing problem.

@GetVladimir
Copy link
Author

@jackson-57 thank you for the detailed explanation. That is indeed interesting.

There might be some older monitors that don't have support for YCbCr color at all, so that might also force the M1 Mac to output properly in RGB color.

Let us know if you find out what exactly is causing this, or if you need anything tested on another setup.

Either way, great find and thank you so much for sharing this.

@csergiu
Copy link

csergiu commented Nov 16, 2022

Thanks so much for this! The difference is night and day.

@GetVladimir
Copy link
Author

@csergiu you're very welcome! Thank you so much for your comment and glad to hear that you got RGB color output working

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