Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Guide: Running Arch on a 2018 MacBook Pro

Hardware Prerequisites

You'll need at least the following hardware:

  • At least 3 USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A then:
  • A USB drive
  • A USB keyboard
  • USB to Ethernet adapter, compatible USB dongle or USB tethering on a phone

General notes:

  • I strongly recommend against deleting OSX entirely even if you'll never use it, it is required for locating the WiFi firmware during install and can be valuable for determining which hardware you have.

Build archiso with a custom kernel

You'll need an existing arch install to do this

Or download mine from here: https://r.je/tmp/arch-mbp.iso

  1. Firstly grab a copy of the archiso script as instructed here:

https://wiki.archlinux.org/index.php/Archiso

cp -r /usr/share/archiso/configs/releng/ archlive
cd archlive
  1. Add aunali1's repo to pacman.conf:
[mbp]
Server = https://packages.aunali1.com/archlinux/$repo/$arch
  1. Ignore the original kernel in pacman.conf
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg   = linux linux-headers
  1. Add the linux-mbp pakages to the end of packagesx86_64
...
wvdial
xl2tpd
linux-mbp
linux-mbp-headers
  1. Force the build script to use interactive mode for pacstrap:

sudo nano /usr/bin/mkarchiso

In this file press Ctrl+W type pacstrap and replace every pacstrap -C with pacstrap -i -C:

# Install desired packages to airootfs
_pacman ()
{
    _msg_info "Installing packages to '${work_dir}/airootfs/'..."

    if [[ "${quiet}" = "y" ]]; then
        pacstrap -i -C "${pacman_conf}" -c -G -M "${work_dir}/airootfs" $* &> /dev/null
    else
        pacstrap -i -C "${pacman_conf}" -c -G -M "${work_dir}/airootfs" $*
    fi

    _msg_info "Packages installed successfully!"
}

Note: There is definitely a better way to accomplish this

  1. Build the iso:
sudo ./build.sh -v

Press Y to everything including skipping ignored packages (so the only kernel installed is linux-mbp) then write to your usb (where /dev/sdb is your usb) drive:

sudo dd if=out/archlinux*.iso of=/dev/sdb bs=1M
  1. Boot your mac in recovery mode enable booting from USB: https://www.ninjastik.com/support/2018-macbook-pro-boot-from-usb/

  2. Hold option while booting up and select your USB. (For some reason it didn't show at first for me and I had to unplug and re-plug the drive once the menu was on the screen)

Installation

You'll need to use a USB keyboard for the installation

  1. Follow the Arch Install as normal: https://wiki.archlinux.org/index.php/Installation_guide You can resize the OSX partition, I'd already installed Windows in bootcamp which did this for me so I just wiped off windows and installed Linux on the partitions it created.

  2. Mount the existing apple EFI partition (/dev/nvme0n1p1) to /boot (if you haven't run arch-chroot yet it will be mount /dev/nvme0n1p1 /mnt/boot)

  3. After you've used arch-chroot to see the file system as you would post install, add aunali1's repo to /etc/pacman.conf:

[mbp]
Server = https://packages.aunali1.com/archlinux/$repo/$arch
  1. Then install the kernel:
sudo pacman -S linux-mbp linux-mbp-headers
sudo mkinitcpio -p linux-mbp
  1. Use GRUB, (Systemd-boot crashed for me and forced me to hard reboot)

Install your DE and anything you want to use.

Keyboard/touchpad

  1. install yay:
sudo pacman -S git gcc make fakeroot binutils
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
  1. Install macbook12-spi-driver-dkms:
yay --editor=nano --editmenu -S macbook12-spi-driver-dkms

When it says PKGBUILDs to edit? type A to open nano (or substitute your favourite editor in the command above).

In the source( line change the branch to mbp15, replace https://github.com/roadrunner2/macbook12-spi-driver.git#branch=touchbar-driver-hid-driver with https://github.com/roadrunner2/macbook12-spi-driver.git#branch=mbp15

  1. Get MCMrArm's bridge driver and install it to extramodules:
git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git
cd mbp2018-bridge-drv
make
cp bce.ko /usr/lib/modules/extramodules-mbp/bce.ko

you'll need to remember to rebuild the module every time you update the kernel), I'm looking for a way to automate this

  1. Have it load on boot:
sudo nano /etc/modules-load.d/bce.conf

Add the following:

bce
  1. Reboot, you can now disconnect your external keyboard and use the laptop's touchpad.

WiFi

Boot into OSX and run the following in terminal: ioreg -l | grep C-4364

It will show something like:

"RequestedFiles" = ({"Firmware"="C-4364__s-B2/kauai.trx","TxCap"="C-4364__s-B2/kauai-X3.txcb","Regulatory"="C-4364__s-B2/kauai-X3.clmb","NVRAM"="C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"})

    | |   |         |       "images" = {"C-4364__s-B2/kauai-X3.txcb"={"imagetype"="TxCap","required"=No,"imagename"="C-4364__s-B2/kauai-X3.txcb"},"C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"={"imagetype"="NVRAM","required"=Yes,"imagename"="C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"},"C-4364__s-B2/kauai-X3.clmb"={"imagetype"="Regulatory","required"=Yes,"imagename"="C-4364__s-B2/kauai-X3.clmb"},"C-4364__s-B2/kauai.trx"={"imagetype"="Firmware","required"=Yes,"imagename"="C-4364__s-B2/kauai.trx"}}


It'll be different depending on your exact model.

There are three files to note down. A .trx (for me: C-4364__s-B2/kauai.trx), a .clmb (for me: C-4364__s-B2/kauai-X3.clmb and a .txt (for me: C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt

These refer to files on OSX in /usr/share/firmware/wifi. Copy the trx, clmb and txt somewhere you can easily access them when you boot back into linux (e.g. your home directory if you want to mount the HSF partition in linux, a usb stick, etc)

Boot back into linux and place the files in the following locations:

  1. Copy the trx to /lib/firmware/brcm/brcmfmac4364-pcie.bin (e.g. sudo cp kauai.trx /lib/firmware/brcm/brcmfmac4364-pcie.bin
  2. The clmb to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob (e.g. sudo cp kauai-X3.clmb /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob)
  3. The txt to something like /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt. You will need to replace 15,1 with your model number. (e.g. sudo cp P-kauai-X3_M-HRPN_V-u__m-7.5.txt /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt)

Use networkmanager and iwd:

sudo pacman -S networkmanager iwd
sudo systemctl start NetworkManager.service
sudo systemctl enable NetworkManager.service

If you're on kde also install plasma-nm

Configure networkmanager to use iwd. Create /etc/NetworkManager/NetworkManager.conf and add:

[device]
wifi.backend=iwd

Restart the NetworkManager service and you should have wifi working.

Touchbar

If you've installed the mbp15 branch of @roadrunner2's spi driver as outlined above you just need to load the modules:

modprobe apple-ib-tb
modprobe apple-ib-als

If you want the touchbar to display F* keys by default create /etc/modprobe.d/apple-tb.conf and add

options apple-ib-tb fnmode=2

Audio

See MCMrARM's gist here: https://gist.github.com/MCMrARM/c357291e4e5c18894bea10665dcebffb

Create the three files and reboot.

Suspend

As of 20/09/2019 you have to choose between audio and suspend though this will likely change when MCMrARM updates the bridge driver.

  1. Install the suspend branch of the bce module:
git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git
cd mbp2018-bridge-drv
git checkout suspend
make
cp bce.ko /usr/lib/modules/extramodules-mbp/bce.ko
modprobe bce
  1. Blacklist applesmc

/etc/modprobe.d/applesmc.conf

blacklist applesmc
  1. Add pcie_ports=compat as a kernel parameter. Edit /etc/default/grub and add it to GRUB_CMDLINE_LINUX_DEFAULT e.g. GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet pcie_ports=compat" then run grub-mkconfig -o /boot/grub/grub.cfg and reboot.

  2. Currently (20/09/2019) the touchbar driver crashes on resume and the thunderbolt driver causes suspend to take 30+ seconds and resume to take several minutes. This is fixed by automaitcally unloading the problematic modules on suspend and reloading them on resume.

Create /lib/systemd/system-sleep/rmmod.sh and add:

#!/bin/sh
if [ "${1}" == "pre" ]; then
        rmmod thunderbolt
        rmmod apple_ib_tb
elif [ "${1}" == "post" ]; then
        modprobe apple_ib_tb
        modprobe thunderbolt
fi

and make the file executable:

sudo chmod +x /lib/systemd/system-sleep/rmmod.sh

DisplayPort over USB-C

Works out of the box with a compatible adapter

@brodobrz

This comment has been minimized.

Copy link

brodobrz commented Oct 15, 2019

Hello. I have some troubles on macbookpro15,2.
1. Installation/bootloader:

  • When booting from usb, need to edit the command line "press e" and add module_blacklist=thunderbolt, otherwise the system sometimes will stuck on boot with ICM Error.
    Using arch-mbp.iso, Installed all required packages, including linux-mbp linux-mbp-headers. The main problem with GRUB and systemd-boot. When I tried to grub-install with efi to nvmen0n1p1 I always get kernel panic. The only option that worked for me a systemd-boot (with kernel panic as well but when I restarted i saw the possibility of launching distro).
  1. Successfully compiled the module and placed it in extramodules. Then I tried to add that module to mkinicpio.conf
    MODULES=(ext4 bce)
    Since I use lvm and luks in my system, a keyboard is needed at the stage of mounting the root partition with luks.
    Ok, now keyboard work without Touch Bar.
  • Is also necessary to add the thunderbolt module to the blacklist, otherwise the system freezes at boot.
  1. Wifi.
    Ioreg command returns:
    "RequestedFiles" = ({"Firmware"="C-4364__s-B2/maui.trx","TxCap"="C-4364__s-B2/maui-X3.txcb","Regulatory"="C-4364__s-B2/maui-X3.clmb","NVRAM"="C-4364__s-B2/P-maui-X3_M-HRPN_V-m__m-7.7.txt"})

I took these files and according to the instructions placed in the desired folder.

  • maui.trx -> brcmfmac4364-pcie.bin
  • maui-X3.clmb -> brcmfmac4364-pcie.clm_blob
  • P-maui-X3_M-HRPN_V-m__m-7.7.txt -> brcmfmac4364-pcie.Apple Inc.-MacBookPro15,2.txt

Works only with iwctl.

  1. Touchbar
    UPDATED Now touchbar works!

Install macbook12-spi-driver-dkms:
git clone --branch mbp15 https://github.com/roadrunner2/macbook12-spi-driver.git
cd macbook12-spi-driver
make install
Add these lines to file: /etc/modules-load.d/apple.conf
industrialio_triggered_buffer
apple-ibridge
apple-ib-tb
apple-ib-als

reboot.

  1. Sound.
    I get endless messages when calling dmesg -w:
    [ 1357.225355] aaudio_pcm_pointer while not started
    [ 1357.225358] aaudio_pcm_pointer while not started
    [ 1357.225367] aaudio aaudio: Received timestamp update for dev=3a ts=13c00d72d84 seed=0
    [ 1357.571800] aaudio aaudio: Received timestamp update for dev=3a ts=13c157e3d1d seed=0
    [ 1357.918338] aaudio aaudio: Received timestamp update for dev=3a ts=13c2a256fd8 seed=0

And some errors when i try to open pavuucontrol mixer:
[ 1554.167998] aaudio: Backed up the buffer in 75388806ns [16640]
[ 1554.188094] aaudio: Started the audio device in 95484464ns
[ 1554.188110] aaudio_pcm_pointer while not started
[ 1554.188129] aaudio_pcm_pointer while not started
[ 1554.188461] aaudio_pcm_open
[ 1554.188530] aaudio_pcm_hw_params
[ 1554.188541] x86/PAT: pulseaudio:2668 map pfn RAM range req uncached-minus for [mem 0x79400000-0x79430fff], got write-back
[ 1554.190982] aaudio_pcm_trigger 1
[ 1554.192117] aaudio aaudio: Received timestamp update for dev=3a ts=169dcfa5542 seed=0
[ 1554.194244] aaudio: Started the audio device in 3254976ns
[ 1554.194292] aaudio_pcm_pointer while not started

@TRPB

This comment has been minimized.

Copy link
Owner Author

TRPB commented Oct 15, 2019

The network adapter worked and even managed to scan the network, but when you try to connect to any of the networks, the adapter disconnects immediately after successful authorization.

Did you make networkmanager use iwd? Using the default, wpa_supplicant, authorisation does not work.

I tried to include these modules (apple-ib-tb, apple-ib-als, apple-ibridge) both manually and add them to the mkinicpio.conf file (MODULES section), as a result, the touchbar did not work. But, what is strange is that I have a usb drive with archlinux where the grub bootloader is installed and everything is the same there, but the touchbar works, why? No idea. Even stranger is the fact that after rebooting from this external drive with grub on which the touchbar works, it continues to work from the internal drive from under systemd))

It may be that including them in MODULES loads them too early and the hardware isn't ready. Once you've booted try rmmod apple-ib-tb then modprobe apple-ib-tb and see if to works.

@brodobrz

This comment has been minimized.

Copy link

brodobrz commented Oct 15, 2019

The network adapter worked and even managed to scan the network, but when you try to connect to any of the networks, the adapter disconnects immediately after successful authorization.

Did you make networkmanager use iwd? Using the default, wpa_supplicant, authorisation does not work.

Fixed. Thanks. Works only with iwctl.

I tried to include these modules (apple-ib-tb, apple-ib-als, apple-ibridge) both manually and add them to the mkinicpio.conf file (MODULES section), as a result, the touchbar did not work. But, what is strange is that I have a usb drive with archlinux where the grub bootloader is installed and everything is the same there, but the touchbar works, why? No idea. Even stranger is the fact that after rebooting from this external drive with grub on which the touchbar works, it continues to work from the internal drive from under systemd))

It may be that including them in MODULES loads them too early and the hardware isn't ready. Once you've booted try rmmod apple-ib-tb then modprobe apple-ib-tb and see if to works.

Yes I tried this. Tried various options, unfortunately without result. The keyboard works, touchbar does not work.

@AndreasAZiegler

This comment has been minimized.

Copy link

AndreasAZiegler commented Oct 20, 2019

I followed the steps in the guide and installed rEFInd. When I select the linux-mbp I got the following error message:

Starting version 243.51-1-arch
:: running hook [udve]
:: Triggering uevents...
ERROR: device `` not found. Skipping fsck.
:: mountin `` on real root
mount: /new_root: no filesystem type specified.
...
@caioquirino

This comment has been minimized.

Copy link

caioquirino commented Oct 21, 2019

Have you tried to create the grub bootloader with the --removable flag in grub-install command?

More info: https://wiki.archlinux.org/index.php/Installing_Arch_Linux_on_a_USB_key#GRUB

I saw this error before, but for me it happens when I try to boot using MAC's bootloader directly instead haha, I think that this is related with the way you created your fstab. You can try to generate it using BY_LABEL or BY_UUID instead of the device path.

@tegan-lamoureux

This comment has been minimized.

Copy link

tegan-lamoureux commented Oct 26, 2019

First off - thank you for the guide!! Two minor comments I ran into today while doing this, in case others hit the same thing:

  1. I had to manually sign/confirm trust for the pacman key for Syed Aun-Ali Zaidi <admin@kedeit.net> in order for the archiso script to install the new kernels from aunali1.
  2. The archiso script also failed for me when it tries to run mkinitcpio, since it's looking for /boot/vmlinuz-linux in the working directory. I had to change a few locations in build.sh to say vmlinuz-linux-mpb instead of just vmlinuz-linux.

  1. [Edit - addition]: I also had to use the --removable flag with grub or I got a kernel panic every time I tried to install from the chroot. Specific commands so that it may help others: grub-install --removable --target=x86_64-efi --efi-directory=/boot/ --bootloader-id=GRUB (with /boot/ mounted to /dev/nvmen0p1 from outside of the chroot).
@AndreasAZiegler

This comment has been minimized.

Copy link

AndreasAZiegler commented Oct 27, 2019

I installed grub and tried the command with --removable. All what I got was another boot option in the Mac boot loader and in rEFInd with an empty grub console when I select it. My rEFInd option for my arch system looks like the following:

archisobasedir=arch archisolabel=ARCH_201909 initrd=boot\initramfs-linux-mbp.img

Is something wrong in this rEFInd options for my arch system?

@tegan-lamoureux

This comment has been minimized.

Copy link

tegan-lamoureux commented Oct 27, 2019

Yeah it added a boot entry for me in the mac bootloader, but it wasn't anything special or different, it just boots arch (with the standard grub entries) when I selected it.

I've never used rEFInd, is that similar to efibootmgr? Also did you make sure to generate the grub config after running the install command? That could be why you don't see entries. grub-mkconfig -o /boot/grub/grub.cfg

@TrueNix

This comment has been minimized.

Copy link

TrueNix commented Nov 26, 2019

after updating to Catalina, linux wont boot "kernel panic get_cert_list"
to resolve the issue add to kernel options noapic efi=noruntime it would stuck on loading amd graphics then add nomodeset then it will boot to the desktop.
tested on ubuntu daily build 20.4

@satya-arjunan

This comment has been minimized.

Copy link

satya-arjunan commented Dec 10, 2019

@TrueNix can you provide the steps you got Ubuntu 20.04 daily build to run on recent Macbook. Thanks.

@satya-arjunan

This comment has been minimized.

Copy link

satya-arjunan commented Dec 10, 2019

@brodobrz I also have a 15,2 Macbook. I am unable to get either grub or systemd-boot to setup well and boot Arch. Can you provide the steps after arch-chroot to get systemd-boot running?

@cubimon

This comment has been minimized.

Copy link

cubimon commented Dec 12, 2019

I had to unmask the ´systemd-boot-system-token.service´ so I could boot with systemd-boot, since it tries to set/touch some uefi variable which doesn't work on the MBP.
I had to modify way more than the branch name of the macbook12-spi-driver-dkms aur (remove the dkms.conf file, which requires applespi).
I used aunali1's bridge driver aur on github, instead of MCMrARMs, the module name is apple-bce instead of bce.

@cubimon

This comment has been minimized.

Copy link

cubimon commented Dec 16, 2019

@satya-arjunan I installed arch on a different pc on an external ssd to avoid the uefi errors when running bootctl install on the mbp. The installed drive can be used afterwards on the mbp, copy should also work. The default linux kernel without modification works fine, but without wifi/keyboard.

@AndreasAZiegler

This comment has been minimized.

Copy link

AndreasAZiegler commented Dec 30, 2019

I finally got some time to setup Arch on my MacBookPro 15,1. I got almost everything working. The following things do not yet work to my full satisfaction and some people might have a solution for it:

  • On every start I need to restart the NetworkManager sudo systemctl restart NetworkManager in order to have WiFi working
  • I had to install gnome-keyring to get WiFi with passwords working
  • I have the amdgpu video driver and with this it seems not possible to change the resolution. As these MacBook displays have a too high resolution for my eyes, I would like to choose a lower resolution.
  • When I run pavucontrol it oscillates between the normal view and the message that it tries to connect to pulseaudio (Audio is working and I can change the volume on the touchbar but I use pavucontrol normally to select my bluetooth head phone as audio sink which doesn't work now)

If anyone could help me to resolve these issues, I would be really glad.

@cubimon

This comment has been minimized.

Copy link

cubimon commented Dec 30, 2019

  • Use iwd instead of wpa_supplicant (Dunedan/mbp-2016-linux#112 (comment))
  • I set Xft.dpi:192 in ~/.Xresources and xrdb -merge ~/.Xresources in ~/.xinitrc, which works almost anywhere, but I would also be interested in a lower screen resolution since it may be a better solution
  • Just try to avoid pavucontrol, I tried to debug it, it seems to be related to the microphone, I use pulsemixer for now
@AndreasAZiegler

This comment has been minimized.

Copy link

AndreasAZiegler commented Dec 30, 2019

Thanks for the feedback @cubimon.

My /etc/NetworkManager/NetworkManager.conf is the following:

# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
[device]
wifi.backend=iwd

and so I thing iwd should be used.

@JPyke3

This comment has been minimized.

Copy link

JPyke3 commented Jan 24, 2020

Hi all, Thanks for the great write up!
Even for a somewhat Arch noobie, I got it going no worries!

Just a few issues that I've had and wanted to clarify:
1. Wifi
I cannot for the life of me get the wifi to work. I ran the command in MacOS and copied the files over to /lib/firmware/brcm/ but after that, Arch will have issues booting. It will get to the first boot sequence where it mounts the drives and then will crash, the fans spin really loud too when this happens.
I suspect I might have made a mistake and maybe copied the wrong files? Not sure, happy to do any troubleshooting.

EDIT: Now this one is working

It found this issue by aunali1, he indicated that if the files are generated form Catalina that they will not work. Sure enough, I was trying to obtain my files from Catalina. He provided an archive of the old files here. Sure enough, when I used his files it worked like a charm after reboot.

So Note about the wifi files, they only work when you retrieve them from a version of MacOS before Catalina

2. Touch Bar

EDIT: Got it working

It turns out that the modules didn't seem to be installed/loaded in order. All I had to do was the following:

git clone --branch mbp15 https://github.com/roadrunner2/macbook12-spi-driver.git
cd macbook12-spi-driver
make
sudo modprobe industrialio_triggered_buffer
sudo insmod apple-ibridge.ko
sudo insmod apple-ib-tb.ko
sudo insmod apple-ib-als.ko

Other than that. Managed to get everything working! Surprised that iSight camera and Bluetooth just work out of the box! Nice work!

@cubimon

This comment has been minimized.

Copy link

cubimon commented Jan 24, 2020

Did you also use iwctl to connect to wifi?

@JPyke3

This comment has been minimized.

Copy link

JPyke3 commented Jan 24, 2020

Did you also use iwctl to connect to wifi?

I couldn't even get that far because I struggled to boot the system once the files were in place. Or have I missed something?

@cubimon

This comment has been minimized.

Copy link

cubimon commented Jan 24, 2020

It is hard to tell, you try to blacklist the broadcom wifi driver to ensure it is causing the trouble or try to read systemd logs

@JPyke3

This comment has been minimized.

Copy link

JPyke3 commented Jan 26, 2020

It seems to definitely be at fault. I put the files back in place then ran rmmod brcmfmac modprobe brcmfmac after it crashed i took a look at the systemd logs. The whole system just stopped responding, no logs were generated and the system crashed. Furthermore, after booting again and it crashing systemd doesn't even recognized the system booted.

@JPyke3

This comment has been minimized.

Copy link

JPyke3 commented Jan 31, 2020

See edits above for resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.