Cover image for Linux on MacBook Pro 2016 / 2017

Linux on MacBook Pro 2016 / 2017

cmiranda profile image Cris ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป ใƒป8 min read

Hi there! ๐Ÿ‘‹ This is my first post on dev.to. I didn't know what to write about so I just decided to talk about what I'm doing right now, installing Linux on my MacBook Pro 2016 (model 13,3 - dual gpu with touchbar). This might also help anyone trying to install Linux on any MacBook without T2 chip (2017 or older).

๐Ÿ“– Context

It all started a few months ago when I became curious about tiling window managers and how I could increase my day to day productivity. I'm a software developer and I have A LOT of open windows and programs running at the same time, so I decided to give tiling window managers a shot. Unfortunately there are not a lot of choices available for macOS, I found yabai which is great! but as I started to tweak config files to be more comfortable working with my laptop I started to feel that it wasn't enough.

Alt Text

After a month or so of using yabai I met i3-wm, and fell in love with it. The only problem... it's only for linux. So I though, what the heck, let's install Linux on my MacBook... and so the journey began.

โš ๏ธ Disclaimer

There are a lot of well written guides on GitHub on how to do this (I'll put the links below), so I'm just going to write down the steps I followed in my particular case and the problems I faced.

๐Ÿ›’ What you'll need

  1. MacBook Pro 13,3 2016 (with touchbar - no T2 chip)
  2. USB stick of at least 8GB
  3. macOS. It doesn't really matter which version but it's important to keep it installed to make the touchbar and some other stuff work.

This MacBook has a few components that will make things a bit more complicated than usual, that is the Touchbar and the AMD dedicated GPU.

Some amazing people worked on drivers to make everything work the best way possible, so fear not, they got us covered ๐Ÿ’ช

๐Ÿง Distro

I have an i7 CPU, 16 GB of RAM. I've tried Manjaro, Ubuntu and Linux Mint and stayed with the latter, it's much more stable in my opinion, but you can pick whatever you want as long as the kernel is 5.0.0 or greater, this is important because some stuff already work out of the box. Also, amdgpu seems not to be working on 5.6, read more here.

๐Ÿ’ฟ Partitioning & Linux installation

1. Disable System Integrity Protection (SIP)

In order to perform some future steps required to install and boot Linux properly, we need to disable SIP (System Integrity Protection).

  • Reboot your Mac. When the startup screen shows up, press and hold the Command + R until the Apple logo appears on your screen.
  • Once it finishes loading and brings you to Recovery Mode, click โ€œUtilities -> Terminal.โ€
  • In the Terminal window, type in csrutil disable and press Enter.
  • Restart your Mac.

2. Create a new partition

I've taken all the images from this amazing guide since it's beautifully explained and since I'm not writing this from macOS

  • Open Disk Utility from the โ€œ/Applications/Utilitiesโ€ folder.
  • Select your boot disk in the sidebar and click the โ€œPartitionโ€ button. Alt Text
  • Click โ€œPartitionโ€ in the dialog box to confirm.

Alt Text

  • Click the โ€œ+โ€ button to add a partition

Alt Text

  • Set the size and name. Choose โ€œMS-DOS (FAT)โ€ for your partition type. This will be erased by the Ubuntu installer.

Alt Text

  • Click โ€œApply,โ€ then โ€œPartitionโ€ to execute.

Alt Text

3. Creating a bootable USB with Linux

  • Download the ISO file from the Linux Mint page or your distro of preference.
  • Download and Install Etcher in order to burn the ISO in our USB stick.
  • Now plug the USB stick, open Etcher and select the ISO file to burn it.

Alt Text- Click on "Flash!" button.

4. Booting from the USB stick

Now we have Linux on our USB stick, it's time to begin the installation. I didn't need to use any external keyboard / mouse but keep in mind that you might require them if for some reason the built-in set doesn't work with the live USB.

  • Restart the Mac with the USB stick inserted while the Option/alt (โŒฅ) key is pressed. This will launch Appleโ€™s โ€˜Startup Managerโ€™ which shows bootable devices connected to the machine. Your USB stick should appear as gold/yellow and labelled โ€˜EFI Bootโ€™. Selecting this will lead you to the distro boot menu.

Alt Text

5. Running the installer

  • Connect to your wireless network (if you can) and choose to install third-party software.
  • At the installation selection screen, choose โ€œSomething Elseโ€ from the bottom.
  • Select the FAT-32 partition you created earlier. Click the โ€œโ€“โ€ button to delete it. Alt Text
  • With the free space selected, click the โ€œ+โ€ to create a new partition.

Alt Text

  • Set the size to 4000 MB and โ€œUse asโ€ to โ€œswap.โ€ (Some people say that for hibernation to work properly, the size of your swap should be around 1.5 times the size of your RAM. Not sure if this is the case, but hibernation didn't work for me anyway).

Alt Text

  • Create another new partition with the โ€œ+โ€ button. Use all the available free space. Set โ€œUse asโ€ to โ€œExt4 journaling file system.โ€ Set the mount point to โ€œ/.โ€

Alt Text

  • Choose the ext4 partition under โ€œdevice for bootloader installation.โ€

Alt Text

  • Click through the remaining steps to create your user and finish the installation.

๐Ÿง™ Linux tweaks

Alt Text

So far you should have Linux installed on your MacBook just fine, the built-in display, keyboard and trackpad should be working out of the box. Now we're going to fix the following:

  1. ๐Ÿ“ถ Wifi
  2. ๐Ÿ•ต๏ธ Spoof macOS
  3. ๐Ÿ“ผ Switch to the iGPU
  4. ๐Ÿ”Š Audio
  5. ๐Ÿ‘‰ Touchbar

Keep in mind that Wifi won't work until you reboot.

1. Wifi

This MacBook model uses a Broadcom wireless board which is not great but at least we'll get decent wifi. There's an issue with the brcmfmac module used by the kernel. Here's how to fix it.

  • Download this file
  • And then cp brcmfmac43602-pcie.txt /lib/firmware/brcm

Wifi works generally ok, but there are a few issues you should be aware of:

  • Connectivity signal is not the best.
  • After suspend/wake 5 GHz networks are not visible, and even if they are you cannot connect to them. 2.4 GHz works fine.

2. Spoof macOS

We need to make the laptop thinks she's going to boot macOS, otherwise there are some components that don't get powered, included the integrated Intel GPU. For this we'll use a custom EFI file like this:

cd /tmp
# See more at https://github.com/0xbb/apple_set_os.efi/issues/20#issuecomment-557352747
wget https://github.com/0xbb/apple_set_os.efi/files/3877561/apple_set_os.zip
unzip apple_set_os.zip

# As root...
sudo su 
mkdir -p /boot/efi/EFI/custom
mv /tmp/apple_set_os.efi /boot/efi/EFI/custom

Now we need to edit GRUB

sudo su
nano /etc/grub.d/40_default

# Add the following lines:
search --no-floppy --set=root --label EFI
chainloader (${root})/EFI/custom/apple_set_os.efi

# Update grub

**Note:* If you prefer using rEFInd, that's totally fine. Just remember to uncomment the "spoof_osx_version" line in refind.conf. See more at rEFInd's documentation site.*

3. Switch to the iGPU

This laptop has two GPU boards, one is the integrated Intel Graphics card and the other one is the dedicated ATI Radeon card. Since there are no drivers for this card to work properly we'll have to switch to the integrated one and then power off the dedicated GPU.

sudo su

# Blacklist amdgpu
echo "blacklist amdgpu" > /etc/modprobe.d/blacklist-amdgpu.conf

# Switch to integrated GPU
cd && git clone https://github.com/0xbb/gpu-switch
cd gpu-switch
sudo ./gpu-switch -i
  • Reboot
  • Now we'll load amdgpu module and turn the card off properly.
sudo su
gpu-manager | grep 'amdgpu loaded? no' && sudo modprobe amdgpu || echo 'AMD GPU already loaded'
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

See more at https://github.com/Dunedan/mbp-2016-linux/issues/6#issuecomment-416015734

**Note:* Repeat last three steps every time you reboot (can be automated)*

4. Audio

Audio doesn't work out of the box, here's how to fix it.

sudo su
cd /tmp
sudo apt-get install wget make gcc linux-headers-generic
git clone https://github.com/leifliddy/snd_hda_macbookpro.git
cd snd_hda_macbookpro

**Note:* Changes won't take effect unless you reboot the system.*

5. Touchbar

sudo apt-get install git dkms

cd /tmp
echo -e "\n# macbook12-spi-drivers\napplespi\napple_ib_tb\nspi_pxa2xx_platform\nintel_lpss_pci" >> /etc/initramfs-tools/modules

git clone https://github.com/roadrunner2/macbook12-spi-driver.git
cd macbook12-spi-driver
git checkout touchbar-driver-hid-driver
dkms add .
uname -r # check kernel version
dkms install -m applespi -v 0.1 -k 5.3.0-24-generic # replace this with your kernel version

# lsinitramfs /boot/initrd.img-5.3.0-24-generic | grep -i "dkms/apple"

If you want the F-keys to be always on by default and the Fn button for switching from F-keys to special keys, then use the following command (if not, fnmode=1):

echo 'options apple_ib_tb fnmode=2' | sudo tee /etc/modprobe.d/apple_ib_tb.conf
echo 'options apple_ib_tb idle_timeout=60' | sudo tee /etc/modprobe.d/apple_ib_tb.conf
update-initramfs -u -k 5.3.0-24-generic # replace this with your kernel version

You can also swap fn and a control keys:

echo 'options applespi fnremap=1' | tee /etc/modprobe.d/applespi.conf
update-initramfs -u -k 5.3.0-24-generic # replace this with your kernel version

Or remap it to any other key:

# modinfo applespi | grep -w fnremap
parm:           fnremap:Remap fn key ([0] = no-remap; 1 = left-ctrl, 2 = left-shift, 3 = left-alt, 4 = left-meta, 6 = right-shift, 7 = right-alt, 8 = right-meta) (uint)

๐ŸŽ‰ Bonus #1 - Keyboard

Here's a guide on how to remap your keyboard.

๐ŸŽ‰ Bonus #2 - Trackpad

Trackpad is not very good on Linux, here's how to improve it.

What doesn't work

  • Built-in microphone
  • Hibernation
  • Audio after suspend
  • 5 GHz wifi networks after suspend


Check out https://github.com/Dunedan/mbp-2016-linux for an updated status of each component.

Alt Text

That's all Folks!

I hope you enjoyed this guide. Don't hesitate on commenting if you have any questions or you have any new findings regarding this topic.

Big thanks to all the people that made this possible. It's unbelievable the amount of people spending time on this without any retribution whatsoever ๐Ÿ™



markdown guide

Cris, I've been following your very helpful guide. Only issue is that every time the Mint install finishes followed by a reboot, the new Linux install doesn't appear as an option in the Apple boot menu.

Any ideas?


Hi Tom! Sorry for the delay on the response. Have you been able to figure this out?. It sounds like there's something wrong with the partitions (maybe?). Are you using rEFInd?

Let me know!