Skip to content

Instantly share code, notes, and snippets.

@blackgate
Last active October 14, 2024 00:44
Show Gist options
  • Save blackgate/17ac402e35d2f7e0f1c9708db3dc7a44 to your computer and use it in GitHub Desktop.
Save blackgate/17ac402e35d2f7e0f1c9708db3dc7a44 to your computer and use it in GitHub Desktop.
Macbook Pro 2011 - Disable AMD GPU

Known Issues: On High Sierra there are problems related to the screen brightness and sleep issues.

1. Reset SMC and NVRAM

SMC: https://support.apple.com/en-us/HT201295

NVRAM: https://support.apple.com/en-us/HT204063

2. Change the gpu-power-prefs and disable SIP

Boot into recovery single user mode (press and hold Command + S + R) and run the following commands:

nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
csrutil disable
reboot

3. Create a rescue thumb drive (Can be done in any OS)

In this step we will create a rescue thumb drive that you can use every time you are having trouble booting macOS.

3.1. Download ubuntu iso

http://releases.ubuntu.com/17.10/ubuntu-17.10-desktop-amd64.iso

3.2. Mount the iso

On Windows (7 and later) or Ubuntu should be straight forward (you just need to double click the iso). On macOS, assuming you have the iso in the Downloads folder, run the following command on the terminal:

hdiutil attach -nomount ~/Downloads/ubuntu-17.10-desktop-amd64.iso

Which should return something like:

/dev/disk2          	Apple_partition_scheme         	
/dev/disk2s1        	Apple_partition_map            	
/dev/disk2s2        	Apple_HFS  

Then run the following commands to mount and open the iso disk (in my case /dev/disk2)

mkdir /tmp/ubuntu 
mount -t cd9660 /dev/disk2 /tmp/ubuntu/
open /tmp/ubuntu/

3.3. Format and copy the files

Format your thumb drive as FAT32 and name it RESCUE, then copy the EFI and boot folders from the iso to your thumb drive.

3.4. Edit the grub.cfg file

On your thumb drive, open the file at boot/grub/grub.cfg with any text editor and change it to:

set timeout=10
menuentry "macOS" {
   insmod hfsplus
   outb 0x728 1
   outb 0x710 2
   outb 0x740 2
   outb 0x750 0
   search --set=root --file /System/Library/CoreServices/boot.efi
   chainloader /System/Library/CoreServices/boot.efi
}

If you are using High Sierra with APFS change it to:

set timeout=10
menuentry "macOS" {
    outb 0x728 1
    outb 0x710 2
    outb 0x740 2
    outb 0x750 0
    exit
}

If you have more than one macOS installed, add multiple menu entries like this (you can change the name):

set timeout=10
menuentry "macOS" {
    insmod hfsplus
    outb 0x728 1
    outb 0x710 2
    outb 0x740 2
    outb 0x750 0
    search --no-floppy --fs-uuid --set=root YOUR_UUID
    chainloader /System/Library/CoreServices/boot.efi
}

3.5. Boot you mac with the thumb drive

Boot your mac and when you hear the chimes, press and hold Option (alt) and then choose your thumb drive.

If you haven't added multiple menu entries in the last step, you just need to press enter when grub appears and go straight to step 4.

If you have multiple menu entries, when grub appears press c to open the grub console and run the command:

ls -l

A list of partitions should appear. Take note of the UUIDs for your macOS partitions.

Press ESC to exit the grub console.

Press e to edit one macOS menu entry you want to boot.

Replace YOUR_UUID with the uuid of your partition.

Press fn F10 to boot.

Your macOS should now boot normally.

3.6. Change the UUIDs on grub.cfg (Multiple menu entries only)

If you haven't added multiple menu entries, skip this step.

On your thumb drive, open the file at boot/grub/grub.cfg with any text editor and for each menu entry, replace YOUR_UUID with the uuid you got on the step 3.5.

You can now boot from the thumb drive without having to change the uuids every time.

4. Make it permanent

In this step we will make the macOS boot without the thumb drive.

After booting macOS with your thumb drive and with it still plugged, open the terminal and run the following commands (I will assume your thumb drive name is RESCUE, if not, replace RESCUE with your thumb drive name):

cd /Volumes
sudo mkdir efi
sudo mount -t msdos /dev/disk0s1 /Volumes/efi
sudo mkdir /Volumes/efi/boot
sudo mkdir /Volumes/efi/EFI/grub
sudo cp -R /Volumes/RESCUE/boot/ /Volumes/efi/boot
sudo cp -R /Volumes/RESCUE/EFI/boot/ /Volumes/efi/EFI/grub
sudo bless --folder=/Volumes/efi --file=/Volumes/efi/EFI/grub/grubx64.efi --setBoot
sudo bless --mount=/Volumes/efi --file=/Volumes/efi/EFI/grub/grubx64.efi --setBoot

You are now able to boot without the thumb drive.

5. Preventing GPU from waking up from sleep (optional)

When waking up from sleep the GPU is enabled and will drain your battery faster and rise the temperatures slightly. To prevent this, you can use this kernel extension: https://github.com/blackgate/AMDGPUWakeHandler

6. Recover when macOS updates

Everytime macOS updates, you need to bless grub again. For this, you need to boot with your rescue thumb drive, and then on macOS terminal run the following commands:

cd /Volumes
sudo mkdir efi
sudo mount -t msdos /dev/disk0s1 /Volumes/efi
sudo bless --folder=/Volumes/efi --file=/Volumes/efi/EFI/grub/grubx64.efi --setBoot
sudo bless --mount=/Volumes/efi --file=/Volumes/efi/EFI/grub/grubx64.efi --setBoot
@kandman
Copy link

kandman commented Mar 8, 2021

This is great! I've been using the kext solution for years but always had problems with sleeping and shutdown. This solves everything.

Many thanks to the developer and to everyone who has shared their knowledge.

Question: Currently on 10.11.6 and would like to get to 10.12.x. Has anyone done this successfully and if so, how?

Thanks in advance for your time.

@gaddyya
Copy link

gaddyya commented Dec 4, 2021

In my case, I did the following:

  • option + R + Boot
  • csrutil disable
  • reboot
  • option + S
  • mount -uw /
  • mkdir /Extention-off
  • mv /System/Library/Extension/ATIRadeonX3000.kext /Extention-off
  • reboot

This completely disables the discrete graphics and everything else continues to work. Is retained when falling asleep and rebooting, the brightness change is also alive working!

PS. I've tried to disable by nvram, but for me it dosn't work. But this one is done! Excellent! I satisfied!

@jxdesign
Copy link

My 2011 macbook pro was restarting into what seemed somewhat normal, but then would get stuck on a grey screen and I couldn't access anything. Running this line in single user mode:

nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00

did the trick. Thank you so much for making this so clear.

Is there a way to make this permanent? I don't need the whole reboot thumb drive steps. Just wondering if there's a way for me to permanently change the gpu power prefs so I don't have to manually type in each digit and letter. The computer will freeze up when I close the screen and put it to sleep and I"ll get the spinning rainbow ball of death and have to restart, and then type the above code in. So anything to permanently run this would be very helpful!

@IgnacioPaiz
Copy link

In step 3, nothing happens when I click the link. "Download ubuntu iso", am I missing something?

@blackgate
Copy link
Author

@IgnacioPaiz This uses an outdated version of Ubuntu, you probably need to download a newer version.

@zsoltsavanya
Copy link

Hi, the link works here, and no, I think you don't need newer, the old version is fine, I'm still using it.

@m-a-v
Copy link

m-a-v commented Apr 16, 2023

This would be the working URL.
https://old-releases.ubuntu.com/releases/artful/ubuntu-17.10-desktop-amd64.iso

But this Ubuntu version is already very much outdated. Basically, you can still use it, but probably an Ubuntu 22.04 LTS would do as well.

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