Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tzechienchu/2d46377d21bb20b68d924dbae67b2cdf to your computer and use it in GitHub Desktop.
Save tzechienchu/2d46377d21bb20b68d924dbae67b2cdf 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment