Skip to content

Instantly share code, notes, and snippets.

@chrisfcarroll
Created December 31, 2018 18:45
Show Gist options
  • Save chrisfcarroll/ff8ad18be53b0391464a9affeb119364 to your computer and use it in GitHub Desktop.
Save chrisfcarroll/ff8ad18be53b0391464a9affeb119364 to your computer and use it in GitHub Desktop.
force-integrated-graphics.sh for MacBook 17" 2010–2011 With Broken Radeon graphics chip
#! /bin/sh
kextoffdir="/kextoff"
loginhookscript="/Library/LoginHook/LoadDelayedAMDRadeonX3000kext.sh"
echo "---------------------------------------------------------------
Run this script twice.
First, from a Recovery Mode commandline to run csrutil disable.
Second, after rebooting to a Single user mode commandline, with / partition mounted writeable, to do all the things that must be done with csrutil status= disabled
After that, rerun Recovery mode to run \`csrutil enable\` again.
* How to start in Recovery mode? Cmd-R
* How to start in Single user mode? Cmd-S
---------------------------------------------------------------
"
echo "
nb: csrutil disable only works in recovery mode
"
csrutil disable
echo "
csrstatus:
"
csrutil status
echo "
Moving the AMDRadeonX3000.kext out of extensions and updating the extensions cache
"
mount -uw /
mkdir -p $kextoffdir
mv /System/Library/Extensions/AMDRadeonX3000.kext/ $kextoffdir/
touch /System/Library/Extensions/
echo "
Set nvram magic things. This is the step that disables the Radeon as the bootup graphics card
"
nvram 'fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00'
nvram boot-args="-v"
nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs
nvram -p
echo "
Add a loginHook to load AMDRadeonX3000.kext after boot
"
mkdir -p /Library/LoginHook
cat > /Library/LoginHook/LoadDelayedAMDRadeonX3000kext.sh <<EOF
#!/bin/bash
if [ -f /System/Library/Extensions/AMDRadeonX3000.kext ] ; then
syslog -s -l error "The AMDRadeonX3000.kext is back in /Library/Extensions. You may need to re-run $0 to postpone loading this kext until login"
fi
kextload $kextoffdir/AMDRadeonX3000.kext
pmset -a force gpuswitch 0 # undocumented/experimental
exit 0
EOF
chmod a+x $loginhookscript
defaults write com.apple.loginwindow LoginHook $loginhookscript
nvram boot-args="-v agc=0"
echo "
Done.
Use the reboot command to reboot.
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment