Taken from StackExchange
Thanks to LangLangC
For temperature and other improvements see https://gist.github.com/cdleon/d16e7743e6f056fedbebc329333d79df
Shutdown, unplug everything except power and hold
leftShift + Ctrl + Option + Power
I holded for 5 seconds, but holding just for an instant should work
Command + Option + p + r
Until you hear the startup chime two times.
if you are on high sierra 10.13.6+ you might need to use
Command + r
instead
Command + r + s
csrutil disable
nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
nvram boot-args="-v"
reboot
Command + s
It might look as if it hanged, but press enter and you should see the shell (root#)
/sbin/mount -uw /
mkdir -p /System/Library/Extensions-off
mv /System/Library/Extensions/AMDRadeonX3000.kext /System/Library/Extensions-off/
touch /System/Library/Extensions/
reboot
It will show a bunch of text in the screen (don't be alarmed, let it finish) and then it will restart again In second restart it will show text in the screen again and then it will show normal login screen Your computer now should work properly (dGPU off and iGPU on, shown as i in gfxCardStatus
If an update that contains changes to the AMD drivers is about to take place it is advisable to move back the AMDRadeonX3000.kext to its default location before the update process. Otherwise the updater writes at least another kext of a different version to its default location or at worst you end up with an undefined state of partially non-matching drivers.
After any system update the folder /System/Library/Extensions has to be checked for the offending kext. Its presence there will lead to e.g. a boot hang on Yosemite and Sierra, an overheating boot-loop in High Sierra.
Another user SATISFIED with this thread and with the GREAT @cdleon and @artkirienko.
THANK YOU VERY MUCH for this HUGE contribution and for saving our "old" MacBook Pro (early 2011 in my case, 17'').
In my case, it runs on MBP MacOS Yosemite 10.10.5 (latest version)
Some commands from the great @cdleon worked fine, but the second time the steps from @artkirienko worked fine.
After passing all the commands, it FINALLY booted the MBP with no problems and no black, gray screens or hangs. ALL WELL!!!! amazing!!!!!
Just now I upgraded the Hardware (16 Gb RAM, 1 Tb SSD and put the 750 Gb HDD in the DVD bay. I mounted the DVD in an external USB SATA box.
Already transferring all the data from the HDD to the SSD. 1 hour to go and everything seems to be running fine, 1 hour to go.... (fingers crossed)
Just to say that I signed up on GitHub to say thanks here to these two characters who shared their wisdom with ordinary users, GREAT!!!!
(If you come to Spain, let me know that the beers are on me!!!) ;D