MacOS – MacBook Pro: How to disable discrete GPU permanently from EFI

efigpumacmacbook promacos

I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.

My question is:

  • How can I disable the discrete GPU from EFI?

    I assume this is persistent across multiple reboots. I'd also want to know how to undo it if needed.

Update:

The question is basically whether the command mentioned in GfxCardStatus github issue comment here is correct or not, and how to undo it if it doesn't work.

.

An answer to this alone is a correct answer, but it'll be awesome if you can also tell me:

  • If you force integrated graphics in GfxCardStatus, Mac OS X (up to Yosemite at least) doesn't allow you to use multiple monitors (even though the built in Iris Pro can do it).

    If I disable the discrete GPU from EFI, will macOS think that the integrated GPU is the one installed and will it let me use multiple monitors with it?

  • I heard that the same EFI setting is responsible for not even showing the integrated GPU to other operating systems than macOS and you have to trick it somehow to think it's macOS.

    Is that true? And if yes, how to do that?

Best Answer

You can permanently disable discrete graphics card following next steps:

UPDATE! Try to edit NVRAM variable from Single-User mode

The procedure described in the steps 1-3 worked for me until macOS Sierra, but with the upgrade to High Sierra, I started getting a pinkish/reddish screen and I was unable to enter Recovery mode to repeat step 3 as I had to do in previous upgrades. Searching in internet, I stepped into this GitHub issue explaining you may be able to replace steps 1 and 2 with the following command, that you can execute in Single-User mode (boot pressing cmd+s):

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

1. Prepare a Bootable USB pendrive with a non GUI Linux

1.1 Download ArchLinux ISO

  • You need a working computer for that and a spare CD/DVD/USB drive.
  • Download the latest Arch Linux ISO image.
  • Then you could either simply burn this ISO to CD/DVD (which later could be either inserted to MBP's SuperDrive or External DVD Drive connected to MBP by two USB cables) or create a bootable USB.

1.2 Creating the bootable USB with the .iso

  • First, you need to identify the USB device.
  • Open /Applications/Utilities/Terminal in MacOS and list all storage devices:

    diskutil list

    Your USB device will appear as something like /dev/disk2 (external, physical). Verify that this is the device you want to erase by checking its name and size and then use its identifier for the commands below instead of /dev/diskX.

  • A USB device is normally auto-mounted in macOS, and you have to unmount (not eject) it before block-writing to it with dd:

    diskutil unmountDisk /dev/diskX

  • Now copy the ISO image file to the device. The dd command is similar to its Linux counterpart, but notice the 'r' before 'disk' for raw mode which makes the transfer much faster:

    sudo dd if=path/to/arch.iso of=/dev/rdiskX bs=1m

    After completion, macOS may complain that "The disk you inserted was not readable by this computer". Select 'Eject'. The USB device will be bootable.

2. Use Linux to change EFI vars

2.1 Boot to it

  • Insert this CD/DVD/USB to Macbook Pro, hold Option key (alt) while booting.
  • Choose "EFI boot" (that is your bootable installation media).
  • When the menu shows, press "e" key to edit the GRUB options of the Arch Linux archiso x86_64 UEFI CD menu entry while it is selected at the main screen, add nomodeset to the end of this line and press Enter.
  • If everything is done correctly, you will find yourself at the Linux console! (It takes some time so be patient and wait for the prompt)

2.2 Clear existing EFI vars

Looks like efivarfs filesystem is mounted by default! So you can already cd /sys/firmware/efi/efivars and ls to explore this directory and see if there is a gpu-power-prefs-... variable (where ... is UUID of this variable).

  • If there is such a variable, it's better to remove it with rm.

    rm gpu-power-prefs-…

  • If you are getting the "operation not permitted" message while attempting to rm, it means that efivarfs has been mounted as read-only and you need to remount it with read-write permissions and try again:

    cd /
    umount /sys/firmware/efi/efivars/
    mount -t efivarfs rw /sys/firmware/efi/efivars/
    cd /sys/firmware/efi/efivars/
    rm gpu-power-prefs-…

  • If this also fails (you still can’t erase the file), use chattr command to disable file immutability and then erase the file:

    chattr -i "gpu-power-prefs-…”
    rm gpu-power-prefs-…

2.3 Create a new gpu-power-prefs-… file

printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9

2.4 Add immutability to the gpu-power-prefs-… file

This chattr command is supposed to lock a file to make it accessible only by "superuser" - and so that, while booting, your EFI will have no chance to screw up your gpu-power-prefs-... variable under any circumstances

chattr +i "/sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9"

2.5 Unmount efivars and reboot

Change to the root directory to unmount efivars:

cd /
umount /sys/firmware/efi/efivars/

Guarantees that your EFI variables are flushed to efivarfs filesystem. Please unmount it safely before rebooting.

reboot

3 Remove AMD / NVIDIA kexts

Note: You might need to do this every time you update your OS, since it normally regenerates these kexts. You may want to favourite this answer for reference so it is accessible from another device when you need it.

After disabling the dGPU using Arch, normal boot would hang halfway but safe boot will work.

3.1 Move AMD / NVIDIA kext files to a backup directory

Remove all the AMD (or NVIDIA, depending on your card) kext files in the Terminal in Recovery Console. Trying to remove them in Single User just gives sandbox errors, so don’t do it in Single User Mode! (the one that you boot with cmd+s).

  • If you have FileVault, unlock it first.
  • Boot into Recovery (cmd+r) directly. If it fails, then repeat step 2 and retry (dGPU could get active again after booting into the os with AMD / NVIDIA kexts).
  • Start Terminal (This commands are for AMD. If you have NVIDIA, change accordingly)

    diskutil cs list (find Logical Volume UUID: last item)
    diskutil coreStorage unlockVolume UUID (UUID: from previous command)
    cd /Volumes/Macintosh\ HD
    mkdir AMD_Kexts
    mv System/Library/Extensions/AMD*.* AMD_Kexts/
    reboot

I found the procedure in this link, where you can read the attribution of the different sections and a discussion thread on the topic.

I tried it myself on an early 2011 MacBook Pro with a faulty discrete graphics card, that was unable to boot even with the overheating trick, and ended up with a fully functional computer!