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.
For the Macbook Pro 2018 version with the A1990 logic board (motherboard), the above steps work to disable the GPU, with some modifications. The GPU it is using is the AMD Radeon 560X (Polaris architecture) which uses AMDRadeonX4000 kernel extensions (kexts).
Just moving the
AMDRadeonX4000.kext
doesn't work (booting into macOS normal mode will stall). You need to move allAMDRadeonX4000*
files to that separate directory:Run this command for each of them (on the step Move offending kext):
Then proceed as per the instructions in the original post.
You should then be able to boot into normal mode, and reboot normally, with the GPU disabled.
Confirmed working on a fresh install of macOS Catalina, where the root cause is a hardware failure in the GPU (where Apple Diagnostics funnily enough reported "No issues found"), likely due to not cleaning the fans for dust, or too many overheating/cooling cycles causing microfractures on the logic board where the GPU is (or maybe it needs a GPU reballing or similar). The above fix (workaround, really) addresses the boot errors:
panic(cpu 0 caller 0xffffff7fabf28dfa): "virtual bool IOAccelDisplayMachine::display_mode_did_change(uint32_t): AMDRadeonAccelerator driver returns false" @IOAccelDisplayMachine.cpp:345
AMDFramebufferVIB::setPowerState(...) timed out
(when waking up / changing the power state of the graphics card)."IOConsoleUsers: gIOScreenLockState 3"
(graphics subsystem is not initializing correctly).If you need to identify which kext is loaded on your system, you can check the loaded kernel extensions using the command:
kextstat | grep -i amd
This will list all currently loaded AMD-related kexts. Listing the loaded kexts only works if you are able to get into macOS normal mode, which you may be able to, intermittently, when encountering a failing GPU (after the machine reboots a few times on its own after stalling). You don't need to do this, and I would just google which kexts are loaded for your Macbook / GPU combination, or rely on the table above. In macOS safe mode no such kernel extensions are loaded, and that's why you're able to load into safe mode.