Skip to content

Instantly share code, notes, and snippets.

@GetVladimir
Last active November 15, 2024 14:00
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.

@traderdude123
Copy link

@lb2112

I m unable to load it in AW EDID editor. says invalid EDID.

can you share the .bin via some file sharing site and provide a link?

@lb2112
Copy link

lb2112 commented May 20, 2023

@lb2112

I m unable to load it in AW EDID editor. says invalid EDID.

can you share the .bin via some file sharing site and provide a link?

Sure thing - here it is: https://we.tl/t-FTLvqatrhV

@traderdude123
Copy link

@lb2112

Don't know if this will help. https://we.tl/t-wsTUrloRMb

but try this modified edid. If this does not work. you may have to remove some unused sections in EDID and try again.

@lb2112
Copy link

lb2112 commented May 20, 2023

Don't know if this will help. https://we.tl/t-wsTUrloRMb

but try this modified edid. If this does not work. you may have to remove some unused sections in EDID and try again.

@traderdude123 Will give it a go. Thanks. Can I ask what you changed in it? My modified one already removed the 3 references to YPbPr using AW EDID editor.

@lb2112
Copy link

lb2112 commented May 21, 2023

https://we.tl/t-wsTUrloRMb

Don't know if this will help. https://we.tl/t-wsTUrloRMb
but try this modified edid. If this does not work. you may have to remove some unused sections in EDID and try again.

@traderdude123 Will give it a go. Thanks. Can I ask what you changed in it? My modified one already removed the 3 references to YPbPr using AW EDID editor.

@traderdude123 just gave your modded EDID a go. BD applied it correctly, so it was all good. It was mostly same as my mod attempt (I also dropped to 8bit colour depth) but it again dropped the monitor to 30Hz for 4K resolutions. I don't think the little M1 MacBook Air can handle the USB3 data transfer speeds and 4K @ 60Hz, RGB 4:4:4 colour space. Looks like I might have to go with two cables - one USB-C > USB-C for USB data, and USB-C to DisplayPort for video.

Thanks again for your help.

@lb2112
Copy link

lb2112 commented May 21, 2023

OK, was actually happy to leave it YPbPr mode as it looked good enough, but am now noticing that certain shades of grey (e.g. some website backgrounds) are creating a flickering effect in this mode, when covering a certain percentage of the screen (around 75% or more). RGB doesn't have the same issue. Other M1 users have reported this as a problem with some other Dell monitors, like the S2722QC. Not sure where to head with this other than the dual cable solution.

@traderdude123
Copy link

@lb2112

But M1 Macs can do 6k @ 60 hz connected to an external monitor(from apple website specs). So 4k@60hz shouldn't be a problem. yes the RGB requires full bandwidth compared to YPbPr. In YPbPR mode , I m not sure if it does full chroma or does it to chroma sub sampling. In either case, a monitor like that should be able to do 4k@60hz easy with the M1 Macs. Even prior intel Macs could do 6k @ 60hz.

I would also suggest to check connecting your M1 Mac with any other 4k 60hz monitor or TV. Just to make sure Monitor is not the issue.
Does your monitor require a firmware update?

@law94air1976
Copy link

will this work on intel macs? I have a MacPro 5,1 running Monterey 12.3 - LG C1 OLED and RX 6600XT with HDMI 2.1 - getting 4k@120 ybr420 but would like RGB for better text quality.

@GetVladimir
Copy link
Author

@law94air1976 no, this procedure only works for M1 and M2 based Macs.

However, there are other scripts that already work great for x86 based Macs. You can try:
https://gist.github.com/ejdyksen/8302862
or
https://gist.github.com/adaugherity/7435890

@traderdude123
Copy link

@law94air1976 ,

you will not get 4k 120hz RGB 444 on intel Macs either with a MacPro or a e-gpu. Apple has deliberately limited it to 4k 60hz RGB 444 on the AMD 6000 Cards.

I even tried with a DP 1.4 to hdmi 2.1 adapter with VM700 chipset with the firmware that gives 4k 120hz RGB 444 using USB-C to hdmi 2.1 adapter. The same adapter(USBC-HDMI2.1) gives 4k 120hz RGB 444 with Apple silicon Macs. So intel is a no go.

@marekdvorak81
Copy link

Hi, I'm on Ventura 13.3, my DELL U3014 switched to RGB after modifying the files in /Library/Preferences and ~/Library/Preferences/ByHost.
After restart the files were overwritten removing the "LinkDescription" section. I locked the file in /Library/Preferences, the file is not being modified and I get RGB after restart, however it still resets to YPbPr when going back from sleep, even though the files are not overwritten. Any hints here?

@GetVladimir
Copy link
Author

@marekdvorak81 Thank you for your comment.

You did everything correctly. There is an issue in newer versions in macOS which will switch to YCbCr after waking up from sleep.

At the moment, the workaround is to reboot the Mac or prevent it going to sleep

@traderdude123
Copy link

@marekdvorak81 and @GetVladimir

As a paid alternative , might I suggest Better Display. with Better Display , you don't need to reboot after going to sleep. It retains the RGB Settings without even a screen refresh.

Please note I m not in any way affiliated with Better Display. This recommendation is purely based on my experience as a paid users of Better Display.

As of now this is the only working solution that meets the users requirements. The rebooting just to keep the RGB settings is a real pain in practice. That's why I bought BD.

Don't get me wrong @GetVladimir , but this plist modification method is a hit or a miss. but BD Utility is a sure way.

@taylor325
Copy link

taylor325 commented May 28, 2023

Ok guys! I figured how to get always working RGB for ALL SCREENS with GetVladimir method + BetterDisplay.
YESSS!!!!! No more reboot needed! 😎
I followed @GetVladimir + @traderdude123 methods + added more instructions.

You need BetterDisplay and AW EDID Editor apps. (BetterDisplay is free for 14 days, AW EDID Editor is free. 🤩)
Open BetterDisplay.
Go to: Settings -> Displays -> Retrieve display EDID (Extended Display Identification Data)
Retrieve EDID Data -> Export EDID Binary -> Save EDID.bin file to desktop (Use OS Managed method)

screen 1

Open AW EDID Editor and file -> Open your saved EDID.bin file from desktop.
Go to: Header -> Monitor suport and turn off YCrCb 4:4:4 + YCrCb 4:2:2 options. Don't touch for other options!
Save as your modded EDID for desktop with EDID modded.bin file name.

screen 2

Open BetterDisplay again.
Go to: Settings -> Displays -> Custom display EDID (Extended Display Identification Data)
-> Upload custom EDID for this display -> Upload EDID Binary -> Load your saved EDID modded.bin file.
Click Apply EDID Now and your monitor instantly get RGB! 😎
Click EDID override options -> Automatically apply custom EDID upon detection of this display.
Click Preserve continuity in case of an EDID display identity change.
Click Restore factory EDID on quit.
Use my settings for safe!

screen 3

Make sure to run BetterDisplay at startup!

screen 4

Reboot and enjoy RGB screen! 😎

Additional information: If you need RGB screen on login screen you still need this and this procedures for perfect work!

@GetVladimir
Copy link
Author

@taylor325 Thank you so much for the info and for the detailed instructions! I'm glad to hear that you got RGB color output working fully

@Anatharias
Copy link

@taylor325 You're the best !!! Thanks for sharing with the community ! Shame on Apple for not allowing this out of the box

@LetrixZ
Copy link

LetrixZ commented Jun 5, 2023

@taylor325 @GetVladimir do you think this could be done without BetterDisplay?
I would like to try first but my trial already expired a few months ago.
I would like to keep using my USB-C Hub for display output instead of the adapter.

EDIT: Seems like it's working fine after applying this workaround. RGB with 120Hz. Even with HDMI through the same dock :)

@GetVladimir
Copy link
Author

GetVladimir commented Jun 6, 2023

@LetrixZ Thank you so much for your comment!

Yes, the alternative procedure still works without the need to use any 3rd party apps, as you've mentioned.

It's interesting to see if the new macOS 14 Sonoma Beta released today addresses any of the issues.

@Averyy
Copy link

Averyy commented Jun 13, 2023

@GetVladimir I had to get an RMA replacement for my dell ultrasharp that died and since then I haven't been able to get it to set to RGB. On latest 13.4 one monitor connected by USB-C and one via HDMI (both 4k dell ultrasharps).

Tried everything here and nothing is working. I previously had it working fine via editing the plist file but since the new one I can't get it to go to RGB. I also tried stationary+locking it and no luck.

Any tips or has anything changed?

@GetVladimir
Copy link
Author

@Averyy thank you for your comment.

The procedure still works on 13.4. My suggestion would be to try and switch the monitor cables (connect the new one to USB-C and the other to HDMI) and try to modify the plist file again.

@Averyy
Copy link

Averyy commented Jun 13, 2023

And it should work on HDMI as well as USB-C?

Inside the plist file do I only put it in the 2 places at the top of the file? or every where?

@GetVladimir
Copy link
Author

@Averyy yes, it should work for both connections.

For USB-C to DisplayPort cable, you don't even need to modify the plist file.

However, since it's hard to determine which monitor is which, you need to add the LinkDescription key to each UUID, since each one is representing a different connected monitor

@Averyy
Copy link

Averyy commented Jun 13, 2023

@GetVladimir ok thanks for the help. I'll order new monitor cables and try again. Will get a usbc-dp to make the one monitor easy, and then for the hdmi one hopefully a new cable does the trick.

@GetVladimir
Copy link
Author

@Averyy not a problem, I'm glad if it helps.

Let us know how it goes

@taylor325
Copy link

taylor325 commented Jun 14, 2023

@taylor325 @GetVladimir do you think this could be done without BetterDisplay? I would like to try first but my trial already expired a few months ago. I would like to keep using my USB-C Hub for display output instead of the adapter.

EDIT: Seems like it's working fine after applying this workaround. RGB with 120Hz. Even with HDMI through the same dock :)

Hello @LetrixZ Maybe they will fix the bug in macOS Sonoma. BetterDisplay is first aid for me for every day life with M1 Mac.

@entropyconquers
Copy link

Automating RGB Color Force on M1/M2 Macs

Hello @LetrixZ @taylor325 @Averyy @Anatharias @traderdude123 @marekdvorak81

I have created a script that automates the steps mentioned by @GetVladimir to force RGB color mode on external monitors for M1/M2 Macs. I have tested it on a Mac Air with M1 chip.

You can find the script and its instructions in the following repository: Force-RGB-Color-on-M1-M2-Mac-Script

Feel free to try it out and update this README if it works for you as well. Cheers!

@GetVladimir
Copy link
Author

GetVladimir commented Jun 18, 2023

@entropyconquers awesome work, thank you so much for creating the script and for sharing it!

I will check it out and update the post as soon as I'm in front of a computer.

Update: I've added a link to the script in the original post: https://gist.github.com/GetVladimir/c89a26df1806001543bef4c8d90cc2f8#apps-based-on-this-method

@traderdude123
Copy link

@entropyconquers

you could write the entire script in python. why write half in bash? any particular reason?

In any case , good effort. Appreciate it.

@mafeko
Copy link

mafeko commented Jun 19, 2023

Thanks a ton @GetVladimir and @entropyconquers for your efforts. struggled a long time with my M1 you made my day 🎊 🚀

@entropyconquers
Copy link

@entropyconquers

you could write the entire script in python. why write half in bash? any particular reason?

In any case , good effort. Appreciate it.

@traderdude123 for some reason running python with sudo was not enough to copy and move/rename the plist file from /Library/Preferences.

I tried writing the whole thing with bash but modifying JSON/XML is a nightmare in bash without any external dependency.

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