Skip to content

Instantly share code, notes, and snippets.

@stefanocoding
Last active July 24, 2024 19:50
Show Gist options
  • Save stefanocoding/c6dbf4489f330021bd9335d655c9fbbf to your computer and use it in GitHub Desktop.
Save stefanocoding/c6dbf4489f330021bd9335d655c9fbbf to your computer and use it in GitHub Desktop.
Activate integrated Intel GPU of a MacBook Pro Mid 2014 (MacBookPro11,3) on Ubuntu 18.04

This may work with other Macbook Pro models that have an Intel GPU and a NVidia one, but I only have proof that this works on a MacBook Pro Mid 2014 (MacBookPro11,3) with Ubuntu 18.04. If you want to be sure about which model you have, run sudo dmidecode -t system in the Terminal and you will see the information about the system including the serial number and product name (MacBookPro11,3 in my case). I'm assuming you have installed the NVidia propietary drivers, which can be installed from the application "Software & Updates" in the tab "Additional Drivers".

Steps to use the Intel GPU:

  1. Run lspci |grep VGA and check that only one line mentioning "NVIDIA" is printed. This is to be sure that you are required to do the following steps. If two lines appear, and one of those mentions "Intel", then you probably do not need to activate the GPU but only select it as the main GPU (jump to the step where you have to "Open nvidia-settings").
  2. Download apple_set_os.efi from https://github.com/0xbb/apple_set_os.efi/releases
  3. Run sudo mkdir /boot/efi/EFI/custom
  4. Run sudo cp apple_set_os.efi /boot/efi/EFI/custom/
  5. Run sudo gedit /etc/grub.d/40_custom
  6. Add the following at the bottom and save the file:
search --no-floppy --set=root --file /EFI/custom/apple_set_os.efi
chainloader /EFI/custom/apple_set_os.efi
boot
  1. Run sudo update-grub
  2. Download gpu-switch from https://github.com/0xbb/gpu-switch/blob/master/gpu-switch
  3. Run sudo ./gpu-switch -i
  4. Reboot
  5. Open nvidia-settings
  6. Go to "PRIME Profiles"
  7. Click on "Intel (Power Saving Mode)"
  8. Click on "Quit"
  9. Log out

References:

@palmerj
Copy link

palmerj commented Aug 23, 2021

Heya. Thanks for this interesting gist. I'm running a Macbook pro 15" mid 2014 with Ubuntu 20.04 (kernel 5.11) and want to get the intel card working. I followed your instructions and on reboot after gpu-switch -i is called the OS boots and the Ubuntu process loading screen starts, but just as gdm3 starts it's locks up. Any hints or things I could try to resolve this? Note I have the nvidia-driver-460 installed.

@stefanocoding
Copy link
Author

Hi @palmerj. Sadly, I don't have Ubuntu installed in the MacBook anymore, so I can't speak from my experience or try something else. Maybe something changed on Ubuntu 20.04.
Are you able to start the desktop without using gdm? It's been a while since I used Ubuntu (I'm using other distribution in my desktop computer) but maybe you can switch to a different "tty" if you press Ctrl+Alt+F[2-12].

@palmerj
Copy link

palmerj commented Aug 24, 2021

Thanks for the reply! Yeah I can get into recovery mode and drop to a root terminal. I can see both GPUs are registered

lspci | grep "VGA"gives:

00:02.0 VGA compatible controller: Intel Corporation Crystal Well Integrated Graphics Controller (rev 08)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 750M Mac Edition] (rev a1)

When I normal boot up and I can't switch to another tty that gives me a terminal. It's just blank screens or screens with cursors that I can type in, but it's not a terminal.

I might try upgrading the kernel to 5.11 and see if that makes any difference. It's currently held back from apt-get upgrade.

Do you think it might help to recompile apple_set_os.efi from source https://github.com/0xbb/apple_set_os.efi? Maybe even consider setting the APPLE_SET_OS_VERSION to a higher version of MacOS...?

@stefanocoding
Copy link
Author

@palmerj When did you install Ubuntu? I ask in case that some upgrade to the system when using MacOS changed something.
Try what you suggested, something related to the version is mentioned here 0xbb/apple_set_os.efi#20
I wish I could have a better answer but it's been a while since I did this 👎

@palmerj
Copy link

palmerj commented Aug 29, 2021

Thanks @stefanocoding I did a fresh install of 21.04 and that solved the issue. I guess there must be some issue with the newer nvidia drivers and some older packages in 20.04.

@stefanocoding
Copy link
Author

stefanocoding commented Aug 30, 2021

I'm glad to hear that, @palmerj! Thank you for the update. Are you able to choose the Intel GPU?

@palmerj
Copy link

palmerj commented Aug 30, 2021

Yes I am. It's running under wayland by default too as that's the default 21.04.

BTW it is possible to set "PRIME Profiles" to "On-demand" at all? Also what's the best way to get switch back to the dedicated NVIDIA GPU?

  1. Run sudo ./gpu-switch -d
  2. Open nvidia-settings
  3. Go to "PRIME Profiles"
  4. Click on "Intel (Performance Mode)"
  5. Reboot (As Nvidia settings prompts)

?

The reason I ask is I've had my macbook fail to boot so many time now, so I'm afraid to change back!

@stefanocoding
Copy link
Author

💪

When I used this method I only wanted to use the Intel GPU, I didn't want to switch between the two constantly. I don't remember if I ever changed it 🤔. But I do remember that at the time it wasn't possible to switch "on-demand/automatically" between the two, if that's what you are asking. Apologies, if I misunderstood.

@palmerj
Copy link

palmerj commented Sep 6, 2021

But I do remember that at the time it wasn't possible to switch "on-demand/automatically" between the two, if that's what you are asking.

Thanks, yes that's what I would like to do.

@stefanocoding
Copy link
Author

Okay. You're welcome 👍

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