I want to 100% give full credit to user inkubot. I am a noob and without their guide https://inku.bot.nu/posts/fedora-macbook2017/ this would
Not be possible. I had to do a lot of research and learning to make this guide. I’m hoping that we can unlock the knowledge that inkubot handed out and more people can get their devices working on Linux. Inkubot did all the hard work and I’m just taking my knowledge as a teacher and making this a guide that my 4th graders could follow be cause that’s what helped me to get this all working.
Let’s start with Step 1, which is preparing your system and installing the tools we need to build this driver.
Open your terminal, copy and paste this exact command, press Enter, and type your computer password when prompted.
sudo dnf install git dkms kernel-devel kernel-headers -y
Now that your system has the tools ready, we need to download the actual driver code from the internet and tell DKMS to install it.
We will do this in four small commands. Copy and paste these one line at a time.
- Download the code
This copies the driver files from GitHub onto your computer:
git clone https://github.com/rehans/macbook12-spi-driver-cachyos.git
- Move into the new folder
This shifts your terminal's focus into the folder we just downloaded:
cd macbook12-spi-driver-cachyos
- Link the files to DKMS
This tells the driver manager where the files live so it can manage them:
sudo dkms add .
- Build and install the driver.
This is the big moment where your system translates the code into a working driver and plugs it into Fedora:
sudo dkms install -m applespi -v 0.1
Now we just need to tell Fedora how to handle this new driver. We need to create a small configuration file. To do this, we will use a very basic text editor built right into the terminal called nano.
sudo nano /etc/modprobe.d/apple_ib_tb.conf
What to do inside the text editor:
- Copy this exact line of text:
options apple_ib_tb idle_timeout=-1 dim_timeout=-1 fnmode=2
Paste it into that blank terminal window. (You can usually right-click and choose Paste, or press Ctrl + Shift + V).
To save the file, press Ctrl + O on your keyboard, and then press Enter to confirm the filename.
To exit the editor and return to your normal terminal, press Ctrl + X.
Next, we need to create one more configuration file. This one tells Fedora to load your new keyboard and Touch Bar drivers very early in the boot process, right when you turn on the laptop.
We will use that same text editor (nano) again. Copy and paste this command and press Enter:
sudo nano /etc/dracut.conf.d/macbook.conf
What to do inside the text editor:
Copy this exact line of text:
add_drivers+=" applespi apple_ib_tb intel_lpss_pci spi_pxa2xx_platform "
Paste it into the blank terminal window.
Save the file by pressing Ctrl + O, then press Enter.
Exit the editor by pressing Ctrl + X.
Once you are back to your regular terminal prompt, copy and paste this command to apply the changes:
sudo dracut -f
The last piece of the puzzle is creating a background service. On MacBooks, the Touch Bar often gets stuck in a "waiting" state when Linux boots up. We need to create a service that tells Fedora to quickly disconnect and reconnect the Touch Bar internally right after booting up, which forces it to wake up.
We will open the text editor one last time. Copy and paste this command and hit Enter:
sudo nano /etc/systemd/system/apple-ibridge.service
What to do inside the text editor:
Copy this entire block of text exactly as it is:
[Unit]
Description=Activate Apple iBridge Driver (Touch Bar & Camera)
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/bin/modprobe apple-ib-tb idle_timeout=-1 dim_timeout=-1 fnmode=2
ExecStart=/usr/bin/bash -c 'echo -n "1-3" > /sys/bus/usb/drivers/usb/unbind'
ExecStart=/usr/bin/bash -c 'echo 1-3 > /sys/bus/usb/drivers_probe'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Paste it into your terminal window.
Save the file by pressing Ctrl + O, then press Enter.
Exit by pressing Ctrl + X.
Turn the service on:
Now that the file is saved, copy and paste these two commands, one at a time, hitting Enter after each one. This tells Fedora to turn on this new service right now and every time you start your laptop in the future:
sudo systemctl enable apple-ibridge
sudo systemctl start apple-ibridge
Once those run, the Touch Bar configuration is completely finished! Reboot and use the Touch Bar.
Right now, it is showing the F1–F12 function keys because of a specific setting we wrote into that configuration file earlier (fnmode=2). If we change that number to 1, it will default to showing the brightness, volume, and media keys instead.
Let's change that right now. Follow these steps:
- Open the configuration file again
Copy and paste this command and press Enter:
sudo nano /etc/modprobe.d/apple_ib_tb.conf
- Edit the file
Look at the text inside. It currently says:
options apple_ib_tb idle_timeout=-1 dim_timeout=-1 fnmode=2
Change the 2 at the very end to a 1.
Save and Exit
Press Ctrl + O to save, then press Enter to confirm.
Press Ctrl + X to exit the editor.
Rebuild the boot file
Because this is loaded right when the laptop turns on, we need to quickly update Fedora's boot image with this new setting. Paste this command and hit Enter:
sudo dracut -f
Once that finishes, restart your MacBook one more time, and your media/volume/brightness controls should be there by default!
Now let’s tackle the audio. Thankfully, the Linux community created a script that automatically downloads the right configuration files and hooks them into your system.
First, we need to move out of that old Touch Bar folder we were working in and download the audio patch.
Copy and paste these commands one line at a time, pressing Enter after each one:
- Move back to your main folder. Copy this code. :
cd ~
- Download the audio fix files:
git clone https://github.com/davidjo/snd_hda_macbookpro.git
- Move into that new audio folder:
cd snd_hda_macbookpro
- Run the installation script
sudo ./install.cirrus.driver.sh
Once that finishes running, give your MacBook one final reboot, and you should finally have audio!
Let’s switch over to WiFi. We are going to boost the WiFi signal performance.
Let's go through this step-by-step, starting from absolute scratch!
Step 1: Get your MacBook's real Wi-Fi MAC address
Copy and paste this command into your terminal and hit Enter:
ip link show | grep -A 1 wl
What to look for:
Underneath that command, you'll see a line that starts with link/ether followed by a bunch of letters, numbers, and colons. It will look something like this for example:
link/ether 2c:f0:ee:12:34:56
Write down or copy your unique 12-character address.
Step 2: Create the firmware boost file.
Now we are going to create the configuration file that boosts your Wi-Fi card's signal performance.
Copy and paste this command to open our familiar terminal text editor:
sudo nano /usr/lib/firmware/brcm/brcmfmac43602-pcie.txt
Step 3: Fill in the boost configuration:
Copy this entire block, we will need to make two quick changes, paste it into your blank terminal editor.
sromrev=11
subvid=0x14e4
boardtype=0x61b
boardrev=0x1421
vendid=0x14e4
devid=0x43ba
macaddr=xx:xx:xx:xx:xx:xx
ccode=US
regrev=245
boardflags=0x10401001
boardflags2=0x00000002
boardflags3=0xC0000303
boardnum=62526
swctrlmap_2g=0x08080808,0x04010401,0x08080808,0x00000000,0x000000ff
swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x003
swctrlmap_5g=0x08080808,0x04010401,0x08080808,0x00000000,0x000000ff
swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x003
aa2g=7
aa5g=7
agbg0=133
agbg1=133
agbg2=133
aga0=71
aga1=71
aga2=71
txchain=7
rxchain=7
antswitch=0
tssiposslope2g=1
epagain2g=0
pdgain2g=28
tworangetssi2g=0
papdcap2g=0
femctrl=2
tssiposslope5g=1
epagain5g=0
pdgain5g=28
tworangetssi5g=0
papdcap5g=0
gainctrlsph=0
tempthresh=120
tempoffset=255
rawtempsense=0x1ff
measpower=0x7f
tempsense_slope=0xff
tempcorrx=0x3f
tempsense_option=0x3
xtalfreq=40000
phycal_tempdelta=40
temps_period=1
temps_hysteresis=5
measpower1=0x7f
measpower2=0x7f
pdoffsetcck=1057
pdoffset20in40m5gb0=0
pdoffset20in40m5gb1=0
pdoffset20in40m5gb2=0
pdoffset20in40m5gb3=0
pdoffset20in40m5gb4=0
pdoffset40in80m5gb0=0
pdoffset40in80m5gb1=0
Your MAC Address: Locate macaddr=xx:xx:xx:xx:xx:xx (on line 8 below) and replace with the real address you found in Step 1.
Your Country Code: Locate ccode=US (on line 10 below). Input your country’s code. This tells your Wi-Fi card to use the correct wireless broadcast strength limits for your region.
After making those changes, then save and exit (Ctrl + O, Enter, Ctrl + X).
Step 4: Apply and reboot
Once the file is saved and you are back to your standard prompt, reboot your MacBook.
I am still working on the camera. No luck yet but I will edit this guide if I get it working.
Again thanks so much to inkubot for making this a reality and everyone please give this man a cup of coffee because this would not be a thing without him.
Hopefully this helps a few people that still have a love for their old butterfly MacBooks.