Install Arch Linux on Macbook Pro 11,2 Retina (Install guide for year 2017)

Laurynas Karvelis
16 min readMar 11, 2017

Still applicable in 2019 and probably beyond :)

Initially it wasn’t an easy decision to switch from MacOS. After years of enjoying the polished and “just working” operating system I finally got fed up and took a plunge. Wholeheartedly jumped into Linux world. Specifically — Arch Linux world. Only one question still remains — “Why didn’t I use it before?!”

Why Arch Linux

My background is computer engineering. Specifically web application development. Working with open source for years I found myself getting more and more involved with Linux, whether that would simply be web development in and for *nix environment or yet another ssh into a VPS. I got more and more curious about Linux environment and open source approach and ideology in general.

After trying out various Linux distributions now and then I couldn’t find one that would feel just right to me. Until one day. One beautiful day I stumbled upon Arch Linux. It’s granularity, minimalist approach, vastness of available packages, their recency, superb community, unbelievable documentation and full control that is passed onto the user was the answer for me. I can and have to literally cherry-pick every single component for my OS. It’s just beautiful :). Did I mention privacy? Did I mention no pinging to the Apple mothership? :)

What lead me to assemble this guide?

There’s are a few guides online on installing Arch on Macbook Pros, but few of them are up-to-date or relevant, especially for my Macbook Pro 11,2 model. Hence I found myself assembling one too with hopes to help my fellow colleagues to discover new heights :). So, without further ad due…

Presumptions and requirements before installing

I’m all about keeping it stupid simple, yet beautiful:

  • This guide is specifically for Macbook Pro model 11,2 (Early 2014, Retina with Intel GPU). It should be pretty much identical process for other models with some slight deviations. For those with other 11,x models, please consult Arch Wiki and Google.
  • Unix shell must be your friend. You must love terminal. Otherwise leave this guide and stay cosy with MacOS until such day arrives to your heart.
  • You already had some experience running this or other Linux distros. You already have some experience partitioning your disk.
  • This guide is all about single booting — single booting Arch :). You will wipe your entire SSD. FYI MacOS can always be reinstalled via Mac Internet Recovery, so no panic here.
  • No disk encryption will be used. Due to Intel ME and Broadcom Wifi binary blob firmware I am certain specific agencies have/can have access to my machine when needed. There are alternatives for completely open source laptops such as ThinkPad X220 with LibreBoot BIOS, but not much choice there :(.
  • Machine will use least reasonable amount of resources while running. Kept micromanaged and clutter free.

Prepare installation medium

Grab spare USB stick/SD card and download Arch ISO. As of 1st of March 2017 Arch team started deprecating 32bit CPU support, consequentially shrinking installation ISO down to just under 500 MB in size.

On your favorite Terminal in MacOS issue following commands. Pay attention to diskX and rdiskX and replace “X” with a number that points to your physical USB stick.

$ diskutil list
$ diskutil unmountDisk /dev/diskX
$ sudo dd if=path/to/arch.iso of=/dev/rdiskX bs=1m

Let dd complete the write process, that should take a couple of minutes only, be patient. Once ISO image is copied to your USB stick MacOS will bring up an error dialog. Stay calm and click the “Ignore” button.

Depending whether you like Mac startup chime sound now is the time to disable, reduce or increase it’s volumen. Simply mute/increase/decrease volume while in MacOS to your liking and this will stick for every other boot while on Linux.

NOTE: It is recommended by community to keep the chime sound on, as it is a critical indicator for various boot key combinations used later.

NOTE: Now is the time to backup EVERYTHING you need to an external media before you continue with the installation. I recommend avoiding using Time Machine method as on Linux you will definitely have a HARD TIME accessing Time Machine backups. NTFS or FAT32 file systems for external backup media will be your safest bet for now.

Booting into Arch ISO

Reboot your Macbook Pro, press in and hold “C” key to switch to a second boot device that is your USB stick.

Once Arch ISO finishes loading you will be presented with terminal screen. As this Macbook Pro has “retina” screen your eyes will get strained very quickly. To overcome this lets increase your font size in your terminal to something more sensible:

# setfont latarcyrheb-sun32
... or ...
# setfont sun12x22

There, much better now.

An important realization

Silly or not, it took me a while to “get it”. File system root / inside the terminal belongs to USB stick, while everything mounted inside/mnt is the target media AKA your SSD.

Say you managed to install Arch base but something went wrong with /boot/loader/loader.conf configuration on your SSD, root partition was/dev/sda2 and boot partition was/dev/sda1. Boot Arch ISO once again, mount /dev/sda2 /mnt && mount /dev/sda1 /mnt/boot, now you can edit the file simply bynano /mnt/boot/loader/loader.conf. Bam!

This understanding enables you to remount SSD partition(s) at any given time with your Arch ISO media and fix any issues should something go wrong during or after installation process, such as bootloader config screw up. Nothing to fear, all is under control. Your control.

Prevent laptop CPU from overheating during installation

You are sitting in front of empty terminal window and soon enough you start noticing your Macbook getting hot, running top command proves this too. One CPU core is staying at 100% utilization. Most probable cause is the GPE06 interrupt that’s firing at crazy intervals and keeps “kworker” process busy. It’s better to fix that temporarily now and prevent laptop from overheating as we will stay without a reboot for a quite a while. To make sure it’s GPE06 or some other GPE interrupt invoke:

# grep . -r /sys/firmware/acpi/interrupts/gpe*

The one line with high number indicates which interrupt needs to be disabled:

# echo "disable" > /sys/firmware/acpi/interrupts/gpe06

We will come back to solve this problem permanently later once Arch is installed.

Establishing internet connection before continuing

Before wiping your SSD lets make sure we can access the Internet as Arch ISO will be downloading all packages from Internet. Although some Macbook Pros have their Wifi modem drivers supported out-of-the-box in Linux, it’s ain’t the case with Macbook Pro 11,2 model that is using Broadcom Wifi/Bluetooth modem.

As this laptop model doesn’t have Ethernet port either, we have two sensible options here:

  1. Convenient one. Internet tethering from your phone over USB cable;
  2. Dongle. Getting yourself a cheap-ass Ethernet-to-USB dongle.

I prefer the 1st solution. As most of you will have a smartphone by the side and already connected to internet. All you need to do now is to enable internet tethering on your phone, connect it to your laptop with USB cable and invoke this command:

# ip link

This will detect new network interfaces. Along with standard lo interface you should see another called something like enp0s25. As we have “dhcpcd” service running, we can easily connect that interface to the Internet:

# dhcpcd <your_interface_name>

For example in my case that would be:

# dhcpcd enp0s25

To verify you are successfully connected, you might want to do a quick ping test:

# ping duckduckgo.com

If you see packets passing through — you are set.

NOTE: Ethernet-to-USB dongle connection process is almost identical to the method above, except the ip link command will display a differently named network interface.

Wipe and re-partition your SSD

By far the easiest, user friendly and hassle free partition manager is cgdisk. We will be using that. Noob friendly UI should be self-explanatory:

# cgdisk /dev/sda

Once inside cgdisk delete all partitions on your SSD, then create one EFI type partition 200MB in size. Allocate the rest of available disk space allocate to a second partition withLinux type. My Macbook has 16GB of RAM which is more than enough for me, hence I couldn’t be bothered creating Swap partition.

Format and mount newly created partitions

Assuming first partition was EFI it should be at /dev/sda1 and the second should be /dev/sda2, hence we can format them before mounting:

# mkfs.vfat -F32 /dev/sda1
# mkfs.ext4 /dev/sda2

Now lets mount them:

# mount /dev/sda2 /mnt
# mkdir -p /mnt/boot && mount /dev/sda1 /mnt/boot

Install Arch onto your machine

Once both partitions are created, formatted and mounted we can finally install Arch Linux. We will now install Arch base and some development tools necessary later:

# pacstrap /mnt base base-dev

At this point we have Arch Linux installed on disk but installation process is far from finished. We haven’t even installed a bootloader for it. Some basic configuration needs to be carried out as well.

First of all, lets generate/etc/fstab file that describes our disk partition structure we created before:

# genfstab -U -p /mnt >> /mnt/etc/fstab

As we are using SSD on Macbook Pro 11,2. It’s recommended to edit our generated /etc/fstab and add following options to /dev/sda2 to prolong SSD lifetime:

rw,relatime,data=ordered,discard

Mine /dev/sda2 config inside /etc/fstab looks like this:

# /dev/sda2
UUID=b63fea66-078c-41d5-8f31-89ddd9f07bad / ext4 rw,relatime,data=ordered,discard 0 1

Configure your newly installed Arch

We will now change root base into /mnt by:

# arch-chroot /mnt

Then we need to set the locale for your fresh system.

Open the /etc/locale.gen file and uncomment each locale that you’d like to enable, like this:

#en_SG ISO-8859-1
en_US.UTF-8 UTF-8
#en_US ISO-8859-1

Once locales of your preference are “selected”, lets generate them and select one that will be used upon boot:

# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf

Keeping your virtual console font readable

It’s good to keep the larger font we are currently using in your TTY permanent by creating /etc/vconsole.conf file with contents:

FONT=latarcyrheb-sun32

Sync hardware clock and set your timezone

Setting your timezone is simple:

# ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime

In my case it’s:

# ln -s /usr/share/zoneinfo/Europe/Vilnius /etc/localtime

Now lets set the hardware clock from the current system time:

# hwclock --systohc --utc

Let’s give our Macbook a name

echo mac > /etc/hostname

You can of course change “mac” with anything you like.

Set root user password

# passwd

Create your user account

Along with base-devel package group that we installed with pacstrap, we already have sudo package installed too. Ok, lets create a user for you:

# useradd -m -g users -G wheel -s /bin/bash you && passwd you

Obviously, replace “you” with username of your liking. Now open /etc/sudoers file. Navigate to the bottom of that file. You should find this line:

# %wheel ALL=(ALL) NOPASSWD: ALL

Uncomment it. This will allow you to invoke sudo commands without asking for your password all the time.

Macbook specific stuff

We need to enable some kernel modules for fan speed and temperature sensors, open /etc/modules file and insert two lines:

coretemp
applesmc

Time to install bootloader

As Macbook Pro uses EFI to load it’s OS and we made a presumption that we won’t dual boot any other operating system, the easiest and most elegant way is to use systemd-boot boot manager to boot Arch. Along with it we will install intel-ucode package that will update CPU microcode before loading the Linux kernel.

# pacman -S dosfstools intel-ucode

Once packages installed, we will install systemd-boot on our boot partition:

bootctl --path=/boot install

This will install the gummiboot package and run the tool to install the bootloader to our boot partition, that we created earlier.

First we need to find our root partition PARTUUID. It is not the UUID we saw inside /etc/fstab, instead we can run following command to get PARTUUIDs for each partition:

# blkid | awk '{print $1" "$(NF)}'

Output might look similar to this:

/dev/sda1: PARTUUID="60ce694e-bcc0-47fc-ab4a-df4659a0f1c7"
/dev/sda2: PARTUUID="d9650118-bc70-4a67-bd31-9283c43e9ad2"

You only need the PARTUUID of your root partition, in my case root partition is /dev/sda2.

Now we will create the Arch Linux boot entry file /boot/loader/entries/arch.conf take note, and replace PARTUUID with yours:

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=PARTUUID=d9650118-bc70-4a67-bd31-9283c43e9ad2 rw quiet acpi_mask_gpe=0x06

Remember that GPE06 interrupt issue we needed to revisit? If you look more closely into the boot entry file contents, you’ll see one additional kernel boot parameter acpi_mask_gpe=0x06, this is the instruction that masks this ACPI interrupt from being picked up by the kernel, therefore fixing this extreme CPU temperature issue for good.

Lets tell systemd-boot boot manager to use the just createdarch.conf file by overwriting /boot/loader/loader.conf:

# echo "default arch" > /boot/loader/loader.conf

We can now reboot!

We are at a state where we have all the crucial components to successfully boot into our Arch installation. Simply:

# exit
# umount -R /mnt
# systemctl reboot

Once rebooted you can login to your TTY with your newly created user credentials.

Connect to the Internet again

Once logged into your terminal session as your primary user (not root), follow same steps as before to access the Internet, don’f forget to use a correct network interface:

$ ip link
$ sudo dhcpcd enp0s25

Fix unwanted laptop resume after lid is closed

This one is and will be very annoying if left unfixed. So let’s get to it now than later or never at all. We don’t want to find laptop cooking inside your backpack one day, don’t we? Lets check following output:

$ cat /proc/acpi/wakeup

You’ll notice that XHC1 can wake Macbook Pro 11,2 up at random times after lid is closed and laptop is suspended. To fix this issue we will create /etc/udev/rules.d/90-xhc_sleep.rules file with two following lines that will make sure XHC1 is disabled for good:

# disable wake from S3 on XHC1
SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"

After a reboot you can double-check cat /proc/acpi/wakeup output again to verify XHC1 Status is indeed changed to “disabled”. From now on you can suspend your laptop with peaceful mind.

AUR and Yaourt

Arch Linux distro has it’s own official package manager called pacman, it has a relatively useful amount of packages that can be installed onto your system, but it’s nowhere close to what’s available to you from AUR package repository. The Arch User Repository (AUR) is a community-driven repository for Arch users. It contains HUGE amount of packages available to Arch Linux users.

To access AUR repository we will install yaourt package manager that combines official Arch and AUR repositories together. Add these lines to the bottom of the /etc/pacman.conf file:

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

Update the repositories and install yaourt:

$ sudo pacman -Sy
$ sudo pacman -S yaourt

Now we are talking! From now on we will pretty much always use yaourt all the time. Let’s setup Wifi now.

Setting up your Wifi

Macbook Pro 11,2 uses Broadcom BCM4360 Wifi/Bluetooth module that IMHO sucks big time for a couple of reasons:

  1. It’s proprietary driver isn’t included in Linux kernel;
  2. It’s proprietary, binary blob crap and has potential spying capabilities with CIA as per WikiLeaks Vault7 revelations.

There is open source kick ass Wifi module for purchase and replacement, but for the sake of this guide let’s continue with a module that we currently own. Let’s install driver for it:

$ yaourt -S broadcom-wl 

Although we can simply use netctl and dhcpcd services to connect and stay connected after a reboot, the neatest method is to use NetworkManager service with a handly applet that will be super useful a bit later in your favourite DE or WM, so let’s disable install those:

$ sudo systemctl disable dhcpcd
$ sudo pacman -S networkmanager network-manager-applet
$ sudo systemctl enable NetworkManager

After a reboot, you can check if your Wifi network interface is up and running by:

$ ip link

You should now see a Wifi interface similar to wlp2s0. As we don’t have an Desktop Environment (DE) or Window Manager (WM), we will connect to Wifi from terminal. nmcli app not only will connect you this time but will save Wifi credentials for automatic Wifi connection next time you restart your laptop:

$ nmcli dev wifi connect <wifi-name> password <password>

Setup CPU governor and thermal daemons

Should you decide to check what’s going with your CPU with i7z application, you’d notice that CPU clock is constantly running at ~2.5GHz, which consumes too much power and will keep your laptop constantly hot. To fight that we will install and enable two packages to deal with that:

$ yaourt -S mbpfan-git cpupower
$ sudo systemctl enable mbpfan
$ sudo systemctl enable cpupower

The mbpfan-git will control your laptop fans and cpupower will set your CPU governor to what you’ll choose, normally I stick with “powersave”, edit /etc/default/cpupower file:

# Define CPUs governor
governor='powersave'

Setup sound

There is no need to install any sound drivers on new Linux kernels, as Macbook Pro uses Intel audio chipset, hence we only need to enable it. There are two options for sound management, ALSA and PulseAudio. ALSA is a skinny version and I prefer it over PulseAudio (though you might stumble upon some apps that require PulseAudio and will force you to install that as a dependency for the app that needs it). As I mentioned before, I’m a minimalist, therefore I like stuff that just works:

$ yaourt -S alsa-utils

On this particular model HDMI audio output will be selected by default, hence you won’t hear a thing on laptop speakers at first, to fix that and to enable sound chipset power saving we need to create a /etc/modprobe.d/snd_hda_intel.conf file and insert following lines:

# Switch audio output from HDMI to PCH and Enable sound chipset powersaving
options snd-hda-intel index=1,0 power_save=1

After a system restart you can test if your speakers work using this:

$ speaker-test -c 2

You should hear “noise” from the left speaker and a few seconds later from the right speaker. To control the sound via terminal there’s a great app called alsamixer. Using it you can do it all, set sound volume for laptop speakers, headphones, mute and unmute devices etc, try it out.

Install Facetime WebCam drivers

Apparently for a long time Mac community didn’t have a driver for FaceTime webcam, but due to enormous effort from community they managed to reverse engineer the driver and now we profit by simply running this:

$ yaourt -S bcwc-pcie-git

Intel video drivers

Interestingly there is absolutely no more need to install any xorg-video-intel video driver here on Macbook Pro 11,2. Driver provided by xorg-server performs superb and doesn’t drain your battery. So we skip here and move onto GUI.

Graphical user interface — finally :)

We are currently standing at the crossroad of multitude of choices, to use a Desktop Environment (DE) or a Window Manager (WM), or none at all. It is totally your choice.

As this guide isn’t about installing Ubuntu, Fedora, Linux Mint but rather a pure, clean and minimalistic Arch Linux I decided to stick with i3wm (just look at those sexy screens!!!), it’s a super light and extremely powerful window manager (I’m sorry AwesomeWM, lua should be killed with fire). There’s an official i3wm and i3wm with gaps, I’ll be using latter:

$ yaourt -S xorg-server xorg-xrandr xorg-xinit i3-gaps i3-status dmenu feh

Xorg-server will come with libinput driver installed, this will control your touchpad and/or external mouse. I’ve seen other guides recommending mtrack or even worse, synaptics drivers. A few words on those — stay away from mtrack and synaptics, they are utter crap. Wayland is using libinput for a reason as well.

Lets bring our touchpad experience as close to that we used to enjoy on MacOS. We will enable tapping instead of being forced to click the bottom section of touchpad, will enable natural scrolling and will setup trackpad acceleration like it is on MacOS. We need to create a file /etc/X11/xorg.conf.d/30-touchpad.conf and insert these lines:

Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "NaturalScrolling" "true"
Option "ClickMethod" "clickfinger"
Option "AccelProfile" "flat"
EndSection

For our external mouse we will only enable natural scrolling as well. All other defaults just work with libinput. We create another file /etc/X11/xorg.conf.d/30-pointer.conf with these contents:

Section "InputClass"
Identifier "pointer"
Driver "libinput"
MatchIsPointer "on"
Option "NaturalScrolling" "true"
EndSection

Let’s prepare our i3wm, GTK3 and QT apps for HiDPI

I like to keep my retina screen at 190dpi. Hence I will force Xorg to use this DPI.

Lets create ~/.Xresources file with these lines:

Xft.dpi: 190
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

And finally, lets create ~/.xinitrc file that will launch our i3 window manager once startx command is invoked in your terminal:

# Adjust keyboard typematic delay and rate
xset r rate 270 30
# Start Xorg server at this DPI
xrandr --dpi 190
# Merge & load configuration from .Xresources
xrdb -merge ~/.Xresources
# Let QT and GTK autodetect retina screen and autoadjust
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
# Finally start i3wm
exec i3

Password manager to go

Finding password manager that is elegant, syncs and is usable on your smartphone wasn’t easy to find at first until I stumbled upon “Enpass”. This one works on Linux, Mac, Windows, Android and iOS. To install it here just run:

$ yaourt -S enpass-bin

Useful pacman, yaourt commands

To upgrade your system and other non-git packages invoke:

$ yaourt -Syyu

To upgrade yaourt git packages:

$ yaourt -Syyua --devel 

To remove a package and it’s dependencies that aren’t being used by other packages to keep the system clean and tidy:

$ yaourt -Rcs <package_name>

To get the list of all packages you directly installed (excluding their dependencies) call:

$ pacman -Qqe

Later in time you forgot what does the installed package do, just simply get info about it by:

$ pacman -Qi <package_name>

Packages that I use on my Mac :)

These are completely optional to your taste, but I find them very useful when combined with i3wm:

$ yaourt -S calc cmatrix compton qutebrowser exfat-utils  i3-scrot i3lock i7z imagemagick weechat kbdlight light mpd ncmpcpp neofetch polkit ranger redshift-minimal rxvt-unicode-better-wheel-scrolling thunar tmux ufw unzip xorg-xdpyinfo xorg-xprop zsh

Fonts that will make web experience suckless

$ yaourt -S ttf-dejavu ttf-linux-libertine ttf-mac-fonts ttf-ms-fonts ttf-opensans ttf-ubuntu-font-family

Using linux-macbook kernel instead of stock

To use a pached Linux kernel specifically for Macbooks you are free to do the following. First, lets add a couple of lines to /etc/pacman.conf file:

[linux-macbook]
SigLevel = Optional TrustAll
Server = http://libpcap.net/repo/linux-macbook

Now that we added another package source, we can install precompiled linux-macbook kernel:

$ yaourt -Sy linux-macbook linux-macbook-headers

During linux-macbook kernel installation yaourt might present you with some useful info on enabling aditional systemd service, do that. Once installed, we need to adjust our bootloader config /boot/loader/entries/arch.conf to load the new kernel instead:

title Arch Linux
linux /vmlinuz-linux-macbook
initrd /intel-ucode.img
initrd /initramfs-linux-macbook.img
options root=PARTUUID=d9650118-bc70-4a67-bd31-9283c43e9ad2 rw quiet processor.ignore_ppc=1 loglevel=3

Dotfiles you might be interested in

If interested, you might have a look at my personal dotfiles repo to get some ideas to have a more complete Arch environment for your Macbook

Dotfiles: https://github.com/laurynas-karvelis/dotfiles

Some system wide configs: https://github.com/laurynas-karvelis/dotfiles

--

--