Skip to content

Instantly share code, notes, and snippets.

@cdleon
Last active October 17, 2023 18:23
Show Gist options
  • Save cdleon/d16e7743e6f056fedbebc329333d79df to your computer and use it in GitHub Desktop.
Save cdleon/d16e7743e6f056fedbebc329333d79df to your computer and use it in GitHub Desktop.

Improving heat management after macbookpro 2011 discrete GPU fix, also a script to automate part of the fix process

Taken from StackExchange

Thanks to LangLangC

NOTE: This is experimental; works for some people, not for others

Improved thermal and power management

Open Terminal.app

Create login hook folder for thermal and power management

sudo mkdir -p /Library/LoginHook

Create login hook file

sudo nano /Library/LoginHook/LoadX3000.sh

Add folowing contents when nano opens

#!/bin/bash
kextload  /System/Library/Extensions-off/AMDRadeonX3000.kext
pmset -a force gpuswitch 0    # undocumented/experimental
exit 0

Use ctrl + o to save and ctrl + x exit

Make it executable

sudo chmod a+x /Library/LoginHook/LoadX3000.sh

Register login hook

sudo defaults write com.apple.loginwindow LoginHook /Library/LoginHook/LoadX3000.sh

Reboot normally

Check that proper kexts exist

kextstat | grep AMD

The command above should display

... com.apple.kext.AMDLegacySupport (1.5.1) ...
... com.apple.kext.AMD6000Controller (1.5.1) ...
... com.apple.kext.AMDSupport (1.5.1) ...
... com.apple.kext.AMDLegacyFramebuffer (1.5.1) ...

And this
... com.apple.AMDRadeonX3000 (1.5.1)  ...

should also appear on the list

Reboot normally

Boot into single user recovery by pressing on boot

Command + r + s

Modify NVRAM

nvram boot-args="-v agc=0"

Reboot

reboot

Script ot make part of the process automatic

Open terminal

Create script

sudo nano /force-iGPU-boot.sh

Add contents

#/bin/sh
sudo nvram boot-args="-v"
sudo nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
exit 0

Make exectuable

sudo chmod a+x /force-iGPU-boot.sh

When booting into single user mode (Cmd + r or CMD + r + s) use

sh /force-iGPU-boot.sh
@GinoLandi
Copy link

Hi Everyone,

for "shutdown" and "restart" (for now I've not test "stop") , I'm trying this method:

logout (Cmd+Opt+Shift+Q) and select restart or shutdown
in this way no block or black screen

With Automator I've create app for logout
Open Automator > New > APP add Apple Script in right box

on run {input, parameters}
tell application "loginwindow" to «event aevtrlgo»
	return input
end run

1)Save app into your preferred folder
2)Click on app the cmd+i , add a preferred icon for app with drag&drop.
3)Add app to the Dock

Test on High Sierra 10.13.6

Hi, I'm on Yosemite and macOS doesn't shutdown or reboot, it is stack on black screen.

Cmd+Opt+Shift+Q works, but I'm trying to automate the process and I don't have Automator.

Anyone had other solutions?

Or there's a way to reverse the fix process?

@raphaelfuzari
Copy link

Hi Everyone,
I was trying to fix my problem with temperature like others here, but in Mojave patched.
For me, only works after i updated mojave to the lastest version, than move the AMDRadeonX3000.kext using single user (cmd+s) to the Extension-off folder and setup the script.
I tried everything right after installing mojave, but not work, like everyone here.
I notice that after updating, a new AMDRadeonX3000.kext show up on Extension folder, because I already has moved before, so maybe that new version work and the old one doesn't. (i think that was the same, but, i do not know.. im confused, hahaha... but hey, its working).
I will attached the kext here.
https://drive.google.com/file/d/1UtThHBTJlWtP9Gv0mvrf5PNM8K_NAhcP/view?usp=sharing

Screen Shot 2021-01-11 at 19 57 29
Screen Shot 2021-01-11 at 19 58 23

@Ech-io
Copy link

Ech-io commented Jan 28, 2021

Hi all!

I used this fix before, everything was fine, but an update reset it so I did everything again. However, this time, after:
kextstat | grep AMD
I found that the following is missing:
... com.apple.kext.AMDLegacyFrameBuffer ...
(edit, this is also missing now)
... com.apple.kext.AMDSupport ...

I looked in Finder and it's in the right place, just not loading I guess? I don't know how to reload Kexts if the touch command didn't do it. My brightness keys also aren't working, so I must have done something wrong, is there maybe a way I can start from scratch?

Any help is hugely appreciated, thanks!

MBP: High Sierra 10.13.6 Late 2011, 15-inch

@FredTheFlintstone
Copy link

So I did this with my aging MBP, 15" Late 2011 high-mileage machine. I found I had to remove the AMDRaedonX3000.kext extension from /System/Library/Extensions even though I followed all the other steps creating the scripts, making changes to nvram etc. Now it works GREAT. Runs reasonably cool, the brightness keys work Perfectly and Sleep mode works Perfectly too. HOWEVER the only thing I have noticed is on boot, I get the dreaded gray (white?) screen for about 35 seconds before the Apple logo and progress bar appear. It makes me think it won't boot! After that its happy. Is this normal for this configuration after these changes? I get no clues looking through dmesg or /var/log/messages. Booting in verbose mode is not helpful either. Should I take out one of the scripts? Is it looking for the foo extension? Or should I make some other change? Or do nothing?

Thanks.

@Ech-io
Copy link

Ech-io commented Mar 2, 2021

So I did this with my aging MBP, 15" Late 2011 high-mileage machine. I found I had to remove the AMDRaedonX3000.kext extension from /System/Library/Extensions even though I followed all the other steps creating the scripts, making changes to nvram etc. Now it works GREAT. Runs reasonably cool, the brightness keys work Perfectly and Sleep mode works Perfectly too. HOWEVER the only thing I have noticed is on boot, I get the dreaded gray (white?) screen for about 35 seconds before the Apple logo and progress bar appear. It makes me think it won't boot! After that its happy. Is this normal for this configuration after these changes? I get no clues looking through dmesg or /var/log/messages. Booting in verbose mode is not helpful either. Should I take out one of the scripts? Is it looking for the foo extension? Or should I make some other change? Or do nothing?

Thanks.

Firstly, I'm no computer scientist, not by a long shot. I just happen to know some things, but anywayyy...
A fix to most issues—I've had to do this often, even when not making any mistakes—is to start over from the beginning. Follow the steps here, https://gist.github.com/cdleon/d1eff7246a25193304284ecec40445b0, and then the steps in this article. I think my 2011 usually just takes a while in verbose mode, with no hanging on a white screen, but that has happened to me occasionally. As far as I know, I think it is just fine. It could be the computer working through the new, possibly unexpected scripts? I don't believe I've ever had an actual hang on the white screen though. So, to my knowledge, it's just a quirk of a fixed machine that you can safely ignore.*

*That said, my 2011 15" just like completely died and it seems a smc or pram issue. There's no usability at all, not even single user terminal. But I got a lot of use out of it under this fix, enough to accept the loss if I must. I'll let you know if I discover something—but I really think leaving this fix in is fine!

@FredTheFlintstone
Copy link

FredTheFlintstone commented Mar 2, 2021 via email

@Ech-io
Copy link

Ech-io commented Mar 2, 2021

Hi Fred,
In that case, I don't think you have anything to worry about at this time! You may consider the hardware mod, this one seems in high regard: [https://realmacmods.com/macbook-2011-radeon-gpu-disable/] I don't know if that will solve the white screen, but it should make your machine completely forget it has the AMD card (which probably isn't 100% dead, since the steps worked) and thus I don't think it will engage with the drivers at all! I don't have jump wires on hand to try this, so I can't give any testimony, but if you can do it you should have your machine working as well as it can! (If the white screen remains, then it probably means nothing)

@MBP2011User
Copy link

Hi Fred the Flintstone,

I have some ideas for you.

The white screen delay could be your Mac looking for the system, it might be an unrelated problem. Next time you get into the system try going to preferences, clicking on start up disk, click the lock to make changes, select start up disk and then click the lock to lock it back up again. See if that solves it.

Another problem I discovered - the first time I did the fix, I re-anabled system integrity by entering csrutil enable in terminal in system recovery. When I did this I got problems. I have had to leave system integrity disabled.

If you need to restore kexts you could try re-installing high Sierra, doesn't need to be a fresh install, just run the installer over your existing system. However, it might be easier to reinstall it using another machine with your faulty display machine in target disk mode, if you have access to one. Or you may be able to copy them from another working machine of same model/year.

Finally, a long shot. The hard drive cables are prone to failure on all Macbook pros up to 2012. That could also be causing the white screen start up delay if you have an intermittent fault. You can get replacement hard drive cables on eBay.

Also if you have a dual hard drive in your MacBook by use of a CD caddy, make sure the system is on the disk in the hard drive bay and not the one in the CD caddy. Pre 2012 Macs don't like the system to be on the CD drive, I know that it causes a problem with system recovery and who knows what else.

I don't think the realmacs mod idea of removing the resister is a good solution. I think you lose brightness control with that for one thing.

All the best.

@FredTheFlintstone
Copy link

FredTheFlintstone commented Mar 3, 2021 via email

@Brax84
Copy link

Brax84 commented Apr 24, 2021

Goodmorning everyone,

in the next days i will try to install Catalina and i will try booting without the original uefi but with the UEFI Opencore bootloader from the hackintosh world. With Opencore it is possible to disable the dGPU and force the iGPU to work, and the temperatures should be under control.
If it works I will post a guide based on my MacBookPro8,2
Note: For Big Sur install the big problem is "No GPU Acceleration in Big Sur" for this model SOURCE

@tarajano
Copy link

Can't thank you enough!
My MBP 2011 is ready to go another 10 years with me.

@OmarcianoG
Copy link

Goodmorning everyone,

in the next days i will try to install Catalina and i will try booting without the original uefi but with the UEFI Opencore bootloader from the hackintosh world. With Opencore it is possible to disable the dGPU and force the iGPU to work, and the temperatures should be under control.
If it works I will post a guide based on my MacBookPro8,2
Note: For Big Sur install the big problem is "No GPU Acceleration in Big Sur" for this model SOURCE

Hello Brax!
How was it trying to install Catalina?

@mattdrepo
Copy link

I am also pondering opencore. My use case however would be different:

I have no desire to go past Sierra on this hardware and I am pondering the use of Opencore simply to fake the 13 inch model. I have hackintoshed in the past and looking in the forums, seems you can get around the labelling of MacbookPro8,1 and it's 35w 2 core 4 threads. So I am hoping that it would be a good final resolve. I would probably go one step further and research the desoldering of the motherboard resistor where the power to the faulty gpu is. My issues are however, that this isn't the first time this has been pondered on and apparently there's still some issues with nvram. Sadly there's no information regarding CoreBoot on these machines (the 2011 13" model has been done though, but theres gmux to deal with and more on the 15 and 17 models) - this would help lots. It would literally make the machine a Hackintosh and allow the internal bad GPU to be nulled. I am not confident with the job of soldering onto the area where the ATI controller is, I could probably at best remove the resistor but a nvram reset via Mac OS could leave this a brick (but I have seen people make an internal switch here).

If someone wants to fork the OpenCore for legacy hardware and make a OpenCore for Affected 2011 models repo, maybe we could start by getting the ball rolling and discussing all these great efforts there. It would allow people to have a choice of pushing further into unsupported operating systems OR just spoofing with a model that didn't have the faulty GPU. I am still not 100% though as to whether Mac OS can still write to the hardware irrespective of OpenCore taking over. It would be good to know how from anyone with more knowledge.

@MBP2011User
Copy link

But these 15 & 17" MacBooks are 4 Core not 2 Core so I don't see how faking the label to a 13in model would work unless there is a 13in 4 Core MacBook. Also the 15 / 17 has two fans, if you emulated a 13 then would both the fans still work?
The CDLeon solution seems to work flawlessly on macOS Sierra for me anyway and I've used it on three of these machines, I sold one and now keep one spare. I have also reflowed and repasted the two that I have which makes it easier to reinstall the OS and associated updates although I haven't needed to do that for ages. I still keep the reflowed dGPU disabled as per CDLeon method as a reflow is only a temporary fix.
There are still companies around that will replace the dgpu but I don't know where they get purportedly problem free chips from, I'm sure nobody is still making them and they were all dodgy anyway.
I don't think there is any point in removing the resister. I can't see how the dGPU can be drawing much current if it is not operating.
Anyway, I might look into upgrading to a 2012 model in the future although I do really like the 17" display of the 2011.
I started using a 2011 server as my main computer now, its 4 Core i7 with upgradeable hard drives like the 2011 MacBook pros but it only has an integrated gpu.

@mattdrepo
Copy link

To answer your questions simply. Yes you can spoof the identifier and have your cake. It would take looking at what kernel extensions power the 15 and 17 models as well as what the 13 inch uses specifically. There was also a i7 variant of the 13 which gets things closer. Regarding fans, i forget what kexts are used in the 13 inch model, but a quick hop over to insanelymac to ask would get us there. It's a case of mixing and matching a few things.

Hardware wise I would want to null the use of the chip permanently. But that's my personal choice. By having a switch (as some have done) I could reverse the step, and later invest in some of the hardware solutions that have been employed to use the backlight whilst ignoring the requests to engage the ATI chip (however, once again, using opencore could null some of this potentially by spoofing the system identifier and changing values of kernel extensions while keeping the operating system untouched).

I am sure opencore could be used to prevent nvram writes as a interim step. You could do this over all the things I mentioned previously and keep the identifier the same. But I am not 100% sure here, as the way the Mac Operating system handles nvram was discussed before - other operating systems do not get the same privileges. I could see the UEFI being replaced in the future by Coreboot and opencore being used to allow egpu for those intent on using these machines into BigSur for example (or any metal O.S) like some of the Mac Pros. (hence me wanting to make a physical switch for the capacitor that also sadly handles TB1 power).

Just ideas.

@MBP2011User
Copy link

I think the 2011 i7 variant on the 13in is dual core rather than quad core. 2011 15in and 17in is quad core.

I think you may cause more problems by removing that resistor. I think it is required in order for the backlight to turn on from sleep. That may only apply to high Sierra but I would do a lot of research before you remove that resistor if I were you. Also look into screen brightness control issues.

Incidentally, my 2011 MBP 15&17s have never rewritten NVRAM unless I hold down the reset keys but I'm not sure if losing power via completely flat battery can reset NVRAM.

Something else I just remembered: re-enabling CSR util (system integrity) after applying CDLeon's fix will stopped the fix from holding. If you had problems with the fix you may want to try leaving that disabled and see what happens.

@alato19
Copy link

alato19 commented Oct 29, 2021

Hello Experts!
I'm very grateful for the great help you have offered in this forum.
I followed this guide, with best result.
The only problem I am facing is that macbook freezes on shutdown; I have to force shutdown by pressing the power button.
I have an MBP Early 2011 running OS X El Capitan (10.11.6)

Today I deleted both login hook and force-iGPU-boot script. I reset to default the com.apple.loginwindow and the shutdown is working fine.
I tired also closing the lid and opening back after few minutes; it works.
I'm not using much though the computer, so I'm not sure what happens when the temperature rises.

Do you have any counsel for me? Can I consider this 'solved'?
I'm concerned because I want to sell this MBP and don't want the buyer to have issues. I do have a little experience (minimum comparing to you), but the buyer might not have any.

I appreciate a lot any input on my issue.

Thanks a lot!!!

@MBP2011User
Copy link

Hi alato19,
I'm not advising you but I'll tell you what I do. I use something called Macs Fan Control (Crystalidea software). I use a custom preset details as follows:-
Sensor based value - CPU Proximity.
Temperature fan starts to increase from 60degs.
Maximum temperature 75degs.
This keeps mine running cool, the fan probably comes on more than designed but fans are cheap and easy replace. Logic board is expensive.

Also I'm curious, why don't you run Mac OS Sierra on that machine?

@fa-bs
Copy link

fa-bs commented Dec 19, 2022

amazing, it downs gpu temperature in my mbp 2011 late high sierra.

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