People looking for Night Shift support in High Sierra 10.13.2 you should visit my follow up Supported Mac models for Night Shift in High Sierra 10.13.2.
Night Shift was introduced in macOS Sierra 10.12.4 (Build 16E144f and Public Beta-1) and is controlled by the CoreBrightness.framework and you’ll need at least one of the following – or later – Mac models:
MacBookPro9,x
iMac13,x
Macmini6,x
MacBookAir5,x
MacPro6,x
MacBook8,x
Apple did not release any information about this. Not just yet, but I know this because I located the checks for it in said framework, and there it checks for matching Mac model names:
MacBookPro
iMac
Macmini
MacBookAir
MacPro
MacBook
Night Shift is however not supported – by Apple – on older Mac models. No. There are checks for minimum requirements, which I looked up with help of:
nm /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness|grep _ModelMinVersion
000000000001d490 S _ModelMinVersion
Ok. Now we know the offset. Time to dump the data with help of:
xxd -s 0x1D490 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
0001d490: 0900 0000 0d00 0000 0600 0000 0500 0000
0001d4a0: 0600 0000 0800 0000
MacBookPro9,x
iMac13,x
Macmini6,x
MacBookAir5,x
MacPro6,x
MacBook8,x
I opened the CoreBrightness binary in a hex editor (app) and change the coloured byte that matches with the used hardware. After that I saved the file and copied it to the original location.
The next step is to re-sign the patched framework binary with:
sudo codesign -f -s - /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Well. Now you know how I did it, and in case you happen to own a Mac model that isn’t supported, yet, then you could try to patch the matching value in CoreBrightness.framework as some readers here confirmed that this is working for them with older/unsupported hardware.
Note: The colours that I used should help you to find the byte that you need to change.
Anyway. This my friends is how it is done. Have fun now.
Edit: The order of the MacBook Pro and iMac was wrong – see comments. Fixed thanks to the heads up from Thomas and Nicolinux.
Note: You may only use this patch in your script/software/app if the source code is available, preferable on Github, you are not asking for donations, and clearly state that this is my work. Thank you.
Thanks. I think MacBookPro comes first so that’s MacBookPro9,x and iMac13,x.
Correct. It was rushed out at an insane late hour. Thanks.
Thanks for this !
I think iMac and MacBook Pro are wrong though. I tried, Night Shift does not work on an iMac from 2011 (iMac12,1) and it does work on a 2012 MacBook Pro (MacBookPro10,1).
My guess is it’s the other way around : iMac13,x and MacBookPro9,x. Could you check, please ?
Yup. See my reply to Thomas. Better get some sleep next time. Thanks.
MacBookPro9,x work
Good to know! It’s a little hope for me.
Thanks
Pingback: macOS Sierra 10.12.4で追加される新機能「Night Shift」は2012以降に製造されたMacでのみ利用可能? | AAPL Ch.
Pingback: macOS Night Shift: Das sind die unterstützten Geräte | iTopnews
Fine information – but due to codesigning with any attempt to patch CoreBrightness my monitor control panel “crashes” (quits execution due to codesigning mismatch). Is there a way around this?
Hi Lars,
You need to run
sudo codesign -f -s - [path to CoreBrightness binary]
to re-sign the patched binary. See Update at the bottom of the blog article.Great, thanks!
I can now confirm it works on MacBook Pro 5,2.
Interesting post. I prefer using flux but it’s cool to see these native features getting patched out to everyone else.
Confirmed: MacBook Air 4,1 (11″) works after patching.
Regarding the patch : wouldn’t it be simpler (or at least more generic) to patch the function which check the version of the system, instead of the array (used by this function) ?
By example, by replacing first bytes of CBU_IsNightShiftSupported with :
48C7C001000000 // mov rax, 0x1
C3 // ret
Anyway, thank you for this post, it’s interesting (and seem to confirm it’s an artificial limit from Apple – is it even legal ?).
Hi,
Yes. We can patch it in several different ways, but the end result will be the same.
What I showed you here is how it works, which also results in a more human friendly patch.
We only know the list of currently supported Mac’s, in this Beta, but Apple may change it with a future Beta.
Could you explain how to patch the framework in order to remove restrictions ? It’s not clear to me and I’d like to try on older Macs…
See my reply to Dave.
I think that to “remove” the restriction we should use javerous’ idea. Pike’s idea is just changing the conditions for enabling Night Shift… 😜
I won’t. The code will/may change over time, but the data will most likely not be changed anymore.
Yours is not removing the restriction but changing the array. 😉
Yes. I think Pike’s idea can be more reliable.
“By example, by replacing first bytes of CBU_IsNightShiftSupported …” Could you please tell me where is that line that you changed ? Thank you !
@Sebastien : You can search & edit this function directly with a disassembler like Hopper Disassembler.
Else, for 10.12.4 (16E195), you can use a hexadecimal editor, go to offset 0x1ace7, and change :
55 48 89 E5 41 57 41 56
with
48 C7 C0 01 00 00 00 C3
(don’t search for it, there are multiple instances of this bytes)
Note : confirmed to work on a MacBookPro8,2, after a force resign of CoreBrightness.framework with a Developer ID Application certificate.
so what exactly are you meant to do, i can enter the first and second terminal commands and see the list of numbers indicating the various mac models but what do i do next.
i am on a Mac Pro 3.1 so i do i get that identified by night shift?
1.) Backup the original binary.
2.) Copy the binary to ~/
3.) Open the binary in a hex editor and search for
09 00 00 00 0d 00 00 00 06 00 00 00 05 00 00 00 06 00 00 00 08 00 00 00
4.) Change the last 6 into a 3 (for the Mac Pro).
5.) Save the file.
6.) Copy the patched file over the original one.
7.) Run
sudo codesign
(see blog) to sign it.Note: Always keep a secondary boot option available. Just in case you run into trouble. I’m not responsible for trouble. If the steps are too difficult for you, then don’t go there.
0.) disable SIP (boot into recovery, open terminal and run “csrutil disable”)
Ok so have opened the binary in a hex editor and changed the second instance of 06 00 to 03 00 for the Mac Pro. Now have saved the file, but can you just explain what you mean by copy the patched file over the original one.
Right, now got Night Shift on MacPro 3.1 nVidea GT120 and 23″ Cinema Display.
needed to chmod +x to new core brightness file and replace over existing core brightness exec.
Thank You
When I try to run “codesign”, I receive the following error message :
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: replacing existing signature
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: the codesign_allocate helper tool cannot be found or used
Any idea of what to do?
Thanks in advance!
Missing file. You need to install the CommandLineTools.
Thank you. I did it and it works like a charm now 🙂
big like, Pike
Night Shift with iMac 15.1, works natively ..
MacBookPro 8.1 I change 09 00 0000 0d….. with 08 00 0000 0d… now perfect work
Thanks Pike!
Now that Dev Beta 3 has been released the result of the minimum version search is now
000000000001d470 S _ModelMinVersion
and the next terminal entry should now be
xxd -s 0x1D470 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
so when searching in the binary code the line you are looking for is 1d470
change to your model as described above
and remember to re-sign the patched binary
Interestingly, it´s possible to use the old patched corebrightness file(s) from beta 2 now with the beta 3, also no need to sign again then. (I did this on three machines without any side effects).
Slightly off-topic: Has anyone noticed a dramatic performance/speed drop from 10.12.3 to 10.12.4 on old machines like i.e. the MacBook Pro 4,1 series?
I have a couple of such machines and tried to update to beta-2 or the current beta-3. My impression is (and benchmarks seem to show) that something regarding the correct speed-stepping is gone sour in the 10.12.4 releases. Machines that had a geebench 2 (64bit) score of around 2100 went all down to mere 1250. Measurements have been repeated and I made sure that nothing else hogs the CPU. The machines are so slow that I had to revert back to 10.12.3.
Pike to the rescue? What could I do to check further (most hackintosh related tools that I know of stopped working on El Cap and Sierra).
Just another hint: On the sluggishly slow machines, the CPU temperatures stay low (in the range of 48 to 60°C – whereas normally I encountered 80 to 90°C there)
Finally, with the beta 6 of 10.12.4 things (in terms of speed & speedstepping) on old unsupported C2D machines are back to normal, i.e. my 17″ 2008 MBP is back to around 3700 geekbench 2 score.
Thanks Dave!
Now that Dev Beta 4 has been released the result of the minimum version search is now
000000000001e260 S _ModelMinVersion
and the next terminal entry should now be
xxd -s 0x1E260 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
so when searching in the binary code the line you are looking for is 1e260
change to your model as described above
and remember to re-sign the patched binary
Another round.
In 16E189a (beta 6) offset is now still at 0x1e260 for the patches.
I can confirm it’s working on 10.12.4 Beta 8 (16E192b) on MacBook 5,1
please help, i can not overwrite the original corebrightness file… the other steps are clear.
Forgot to disable SIP?
that was it! now its working. thanks!
Hello Guys
Sorry for my noobiness!! But can someone upload a video doing that? I have a macbook pro early 2011. This was a feature i was looking for and…you know the rest!
Anybody confirmed working on Mac Pro 5,1? I have a Mid 2012 Dual 3.06GHz processors with an AMD Radeon HD 7950 (Mac Edition) 3GB graphics card and 27″ Apple LED Cinema Display.
Hi, I am quite new to all this.I have a late 2011 Macbook Pro may I confirm what byte I need to change please and the easiest way to locating the binary with a hex editor?
Thanks.
Hi, im trying on iMac 2011 model 12.1, so I’m changing 0d, by 12, saving file, overwrite the original and run command for resign, restart and nothing happens, what I’m doing wrong?
i have sip disabled always and I’m editing by Xcode, thanks
You are doing it wrong. The byte 0x0d is 13 decimal. Your 0x12 is 18 decimal. You want 0x0c or lower.
thank you, writing “0c” works perfect for my iMac 12.1.
Hi Pike. Awesome stuff. Think you could apply your brilliance to the external display issue? Why do some work with Night Shift and some do not? In my case, on a Late ’16 MacBook Pro, my iiyama ProLite X4071UHSU-B1 will not show any effects.
Well. Not all monitors are the same, obviously, and some may not support Night Shift. But so far every monitor that I used/checked works fine with Night Shift.
It would be interested to see _why_ some monitors do not support it. My display is connected via a Displayport adapter and the panel isn’t IPS, it’s an MVA one. Maybe one of these properties trigger Night Shift not being available. Was hoping you could shed some light on this 🙂
I don’t think that it is related to IPS. And just to be sure. I checked a couple of old (2007/2009 no IPS) Samsung monitors and Night Shift works.
I’ll see if I can find anything. Will keep you posted here 😉
Thanks! Maybe there are hardware limitations on third party 4k displays?
After more fiddling around I’m fairly certain that the reason why I’m not seeing Night Shift on my external display is because macOS detects it as a “Television” — screenshot http://io.trinka.us/jmUK — I have tried fiddling with the EDID information but haven’t had success with that approach.
Works well on MacBook6,1 (Late 2009) 10.12.4 (16E195). Thanks a lot.
MacBook (13-inch, Mid 2010)
I have a problem.
nm /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness|grep _ModelMinVersion
000000000001e260 S _ModelMinVersion
xxd -s 0x1E260 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
0001e260: 0900 0000 0d00 0000 0600 0000 0500 0000 …………….
0001e270: 0600 0000 0800 0000
but… the last step is impossible
sudo codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Password:
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: replacing existing signature
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: Operation not permitted
Did you disable SIP?
Works on Mac Mini 5,1.
where can I find any video about this?
Hi, Pike. Thank you for your work.
I did every point of instruction(MacBookPro8,1):
0.) disable SIP (boot into recovery, open terminal and run “csrutil disable”)
1.) Backup the original binary.
2.) Copy the binary to ~/
3.) Open the binary in a hex editor and search for 09 00 00 00 0d 00 00 00 06 00 00 00 05 00 00 00 06 00 00 00 08 00 00 00
4.) Change the last 6 into a 3 (for the Mac Pro).
5.) Save the file.
6.) Copy the patched file over the original one.
7.) Run sudo codesign (see blog) to sign it.
But when I run last command(7.):
/System/Library/PrivateFrameworks/CoreBrightness.framework/CoreBrightness: replacing existing signature
/System/Library/PrivateFrameworks/CoreBrightness.framework/CoreBrightness: main executable failed strict validation
Did you use the –strict= argument?
Hi Pike, and thank you.
What do you mean by that?
I had the same result as t2ras: ‘main executable failed strict validation’
No, I only taped command:
sudo codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Thank you guys!
Instruction from “ryanmcv | March 28, 2017 at 9:00 pm” works for me!
I received error “main executable failed strict validation” when I edit CoreBrightness with Vim and command “:% ! xxd” –> “:% ! xxd -r”
Here are step-by-step instructions that I created. You will need Xcode or any basic hex editor.
1. Disable System Integrity Protection by booting into Recovery mode (hold down Command + R during boot-up), opening Terminal, and typing: csrutil disable
2. Restart your Mac and open Finder. Navigate to System/Library/PrivateFrameworks/
Make a copy of the entire CoreBrightness.framework folder (save it to your desktop or a similar place).
3. In Xcode, open the copy of CoreBrightness.framework that you just created. File > Open; Browse to where you just saved CoreBrightness.framework; from within that .framework folder, choose the CoreBrightness icon at the top that looks like a shortcut.
4. In Xcode, press Shift + Command + J on your keyboard. A navigation column will appear on the left-hand side. Secondary/right-click CoreBrightness at the top of that column and choose Open As > Hex.
5. Once the hex code appears, press Command + F to open the Find tool. Search for the following: 09 00 00 00 0d 00 00 00 06 00 00 00 05 00 00 00 06 00 00 00 08 00 00 00
These numbers tell the system which Mac models can used Night Shift.
MacBookPro9,x = “09” in the above hex bits
iMac13,x = “0d”
Macmini6,x = “06”
MacBookAir5,x = “05”
MacPro6,x = second “06”
MacBook8,x = “08”
6. In my case, I needed to allow my early 2011 MacBook Pro (MacBookPro8,2) to use Night Shift. So, in Xcode, I changed “09” in the original hex string to 08. You will need to find the exact model number of your Mac and make the adjustment in Xcode accordingly.
6. Save the file in Xcode (File > Save) and exit. Copy your newly-edited CoreBrightness.framework folder over the existing one in System/Library/PrivateFrameworks/
7. Open Terminal and re-sign the new binary by pasting in this command:
sudo codesign -f -s - /S*/L*/PrivateFrameworks/CoreBrightness.framework/
Version/Current/CoreBrightness
8. Boot back into Recovery mode and re-enable System Integrity Protection (open Terminal and type csrutil enable).
9. Restart your Mac, open System Preferences > Displays, and you should see the Night Shift tab.
Works on MacBook Pro 6,3. Thank you!
Thanks! My 2009 MacBook is now a 2017 model. #youcantkillmymacoff
hi guys.
please, i`m facing some trouble when i run the command:
sudo codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
After it asks for my password, it says: “The specified item could not be found in the keychain.”
( looks like there is a certificate issue)
thanks in advance for your help.
Regards.
Juan Manuel
Check for illegal characters!
It should be:
sudo codesign -f -s - /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Checked with Sierra 10.12.5 and still working.
Edit: Got it. Your
-s –
is the problem. Don’t use a dash “–” symbol but a minus sign “-“.Thank you!!!
it was that!
but this is the final question, i promise, now when I try to run the command it says: “bundle format unrecognized, invalid, or unsuitable”
Thanks in advance again!!
Juan Manuel
Maybe it`s the name of the code for ” Imac” because i have to change the 0D ( wich is in hexa) to 12. I think it`s 0C, but i don`t know if its correct.
Hi Juanma,
Yes indeed. And here is a tip; Use the Calculator.app and change Menu -> View to “Programmer”. This allows you to enter hex and decimal values, and convert them for you. Just in case that you are wondering how people do this sort of things.
What should I write in for an iMac 11,3? Thank you so much for doing this!
Hi Francois,
Change the value for iMac from 0x0d to 0x0b.
Thank you for the invaluable help, as well as a thank you to ryan for the elegant step by step.
Do you have any objections if I share your page on the forums I follow?
I rather have people link to my blog (article). One source. No bits and pieces everywhere.
Works great on my MacBook Pro 7,1 (mid-2010). Thanks, Pike! Don’t know if it will hold the same in 10.12.5 Beta, though.
Finally it works!!!
i don`t know what happen, but when my girlfirend try to edit the file, after that, we try to run the command again and it works!
thank you soo much!
Hi Juanma,
WordPress changed a minus sign in the instruction into a dash symbol. Same things happens with single and double quotes. Probably due to the lack of use of <code> </code> tags.
Hello
MacBookPro8,1
Here is the output
0001e260: 0900 0000 0d00 0000 0600 0000 0500 0000 …………….
0001e270: 0600 0000 0800 0000
What must I do next to enable nightshift please?
Hi JC,
Change the value 0900 into 0800. You can follow the clear instructions in the comments from ryanmcv.
MacBook (13 inches, mid-2010) what am I doing wrong?
/S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness|grep _ModelMinVersion
000000000001e260 S _ModelMinVersion
xxd -s 0x1D490 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
0001d490: 0000 0000 ff9b 2903 2700 0000 0033 0000 ……).’….3..
0001d4a0: 0000 0000 0000 3300 ……3.
sudo codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Password:
Sorry, try again.
Password:
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: replacing existing signature
Hi Anton,
You are using the wrong offset for xxd -s (0x1D490 instead of 0x1e260). Note that this address may change with every new release.
Sorry for the persistence, but what else should I do?
nm S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness|grep _ModelMinVersion
000000000001e260 S _ModelMinVersion
xxd -s 0x1e260 -l 24 /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness
0001e260: 0900 0000 0d00 0000 0600 0000 0500 0000 …………….
0001e270: 0600 0000 0800 0000 ……..
sudo codesign -f -s -/S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
Password:
Sorry, try again.
Password:
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: replacing existing signature
Hi Anton,
No problem. You know what. I’ve read my own article and that was when I noticed that something was missing. I hope that the newly added text is helpful for you. If not. Let me know ok?
Thanks!
can somebody tell me the values for iMac mid 2011?
Thanx in advance
0x01 will work for all models.
I have an 11.6″ 2011 MBA (4,1). I changed “05” to “04” using vim and xxd, and nothing happened after reboot. Then I restored /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness from the backup copy I made and tried followed the instructions in ryanmcv’s post and still nothing. Any idea what I did wrong? Also, why is it codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness
instead of codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/CoreBrightness?
Are you making the edits directly to the CoreBrightness binary that located in /System/Library/PrivateFrameworks? That could be your problem. I would try copying CoreBrightness.framework to your desktop, making the edits to that version, and then copying that newly edited version into /System/Library/PrivateFrameworks and overwrite the original one.
Also, make sure you’re using the correct command in Terminal to sign the binary. Your post above has a dash instead of a minus sign. It should be:
sudo codesign -f -s - /S*/L*/PrivateFrameworks/CoreBrightness.framework/
Version/Current/CoreBrightness
“I would try copying CoreBrightness.framework to your desktop, making the edits to that version, and then copying that newly edited version into /System/Library/PrivateFrameworks and overwrite the original one.”
I tried that the second time, maybe I messed something up and it’s too late?
After running codesign again (making doubly sure I type a minus sign (hyphen?)) I get:
/System/Library/PrivateFrameworks/CoreBrightness.framework/Versions/Current/CoreBrightness: replacing existing signature
Thanks! Works fine. Confirmed: MacBook Pro 15 Early 2011 (MacBookPro8,2)
Hi, I have iMac mid 2011 “12.1”
Tell me what I’m doing wrong, thank you!
Replace all with: 00 0D – 00 0C
http://joxi.ru/GrqLqKLFQJQvzA
In the terminal I prescribe: sudo codesign -f -s – /S*/L*/PrivateFrameworks/CoreBrightness.framework/
Version/Current/CoreBrightness
http://joxi.ru/MAj1kJ1u4X4pa2
Where did the instruction say to replace ALL occurances of 0x00 0x0d with 0x00 0x0c?
That is a big NO NO. Please search for the exact data and ONLY replace the byte that you need to patch.
any hack to enable night shift on “external monitors”?
I say because I have Nvidia GPU connected to a Samsung 4k TV and no night shift tab?
@saschamt & @oscar: did you try to patch the root function (CBU_IsNightShiftSupported) which do the compatibility check ? Search in previous answers to know how.
That is not a good idea. The reason for this is that logic may change over time. It is less likely that the supported models will change and thus that is a better patch.
hi I’m confused …im sorry…I have a MacBook 5,2…can u tell me what to do to fix my brightness? I got the hex decimal app I don’t know what I’m suppose to do from there
Fix brightness? We’re talking about Night Shift here, and in that case, you follow the procedure(s) described here, and in the comments.
I did everything described here: “ryanmcv | March 28, 2017 at 9:00 pm”, and it worked amazing on my trusty MacBook Pro 8,1
Today I inadvertedly upgraded to 10.12.5 Beta (16F54b), and now, Night Shift is gone 😦
Perform the steps again and it will be back. Software Updates are known to replace those Frameworks
Thanks for this guide Pikeralpha :).
I have now removed f.lux.app and can use NightShade even though my rig identifies as a ‘iMac11,1’. I replaced the ‘0d’ with ’07’ and now iMac7,1 is my bare minimum for Night Shade.
Could the same method be applied to allow installing and booting into macOS Sierra from a device Apple have ‘deemed’ incompatible ? I have worked around this issue by changing my board-id but it would be good to not have that restriction imposed by Apple 🙂
Would you know which framework Apple uses to perform the minimum requirements check mentioned at the URL above ?
Sorry, URL here – https://www.tonymacx86.com/threads/macos-sierra-does-not-boot-with-macpro3-1-macpro4-1-system-definitions.200868/
I have iMac model 11,2 mid 2010 I tried looking up the hex for 11 it seems to be 0xB what would be the proper number to replace? Thanks.
Yes.
Hi.
I am on a Mac mini late 2009, version should be 3.1.
What do I have to do? Thanks.
Easy: It does not have any backlashes to set all versions to “01” hex for all platforms/machines. That´s how I did it on all my various machines. “One size fits all” 😉