Running Arch Linux on MacBook Pro 13'' 2015

I've been using the MacBook 13'' early 2015 version since August 2015. It is fair to say that it is a good working laptop, it doesn't win in every single aspect but its definitively well balanced, a result from Apple's proven formula with an some refreshments here and there. Of course, this is as good as opinions go.

After almost a half year of using it daily for my work and personal routine tasks, I was curious to try Linux on it to see how it performs. I found some blogs on the web, but nothing that answered what I was looking for or not very recent, that's why after been using it for a while I decided to share my own experience.
Being a fan of Arch Linux, so I had no doubt about what distro I wanted to try.


NOTE: This guide is about my experience running Arch on a MacBook Pro and how you may improve the experience for that particular scenario. I'll not dwell on how to install Arch Linux, or how to boot Arch onto a MacBook Pro. Those would be an articles into themselves. I suspect that if you gone or want to go this way you probably already installed Arch in the past and know the basics. That said, I'll guide newcomers to the Arch Wiki - Installation Guide for instructions on on to install it, and you might want to check the rEFIng webpage on how to install a boot manager that will allow you to boot Linux on your Mac. If you're using El Captain or sooner version of OSx be sure to check this page as well.

How does Arch perform on the MacBook Pro 2015

Screen

The screen is one of my favorite things on the MacBook, and it works wonderfully on OSx. And this is one of those things that you notice and feel awkward if the experience downgrades somehow so I it was one of the things I wanted to try first. Gladly on Linux, the color profile for the screen was spot on, and I didn't have to do a thing! :)
The retina display on this particular Mac has as resolution of 2560 by 1600 px. There is some support on QT and GTK for retina displays, and once you configure those almost all recent apps will work alright. One can also adapt most browsers and even the IDE I use for work has retina support. Great! On the downside each one of these things have to be configured separately, and they don't even share the same syntax. Also a lot of the applications that do support it, still have one or another thing that needs adjustment, and then there's the case where some older apps don't support it at all. After all, Retina resolutions are not yet that popular except on the Mac. So Retina support is still a work in progress. That being so after a couple of days I decided to lower the resolution, and the best one that worked for me was 1680 by 1050 px. I use KDE, and with text anti-aliasing the difference is minimal. This is the sort of topic some people usually tend to have very different opinions, and possibly some people experience this differently. I think the best way is to try for yourself and find what works best for you.
Apart from that, the screen brightness and keyboard light keys work as expected. You can have the auto-adjustment based on the light sensor, I preferred not to just because I like controlling it manually, but if you do here's how you can do it.

Touchpad

Let's face it, this will probably always be a strong suit for OSx. Still, the support has evolved quite a lot in recent years, and you'll get a lot of the two-finger and three-finger gestures working with this driver:

$ yaourt -S  xf86-input-multitouch-git 

Vertical and horizontal scrolling work properly, zoom works sometimes (depending on the app). It is also possible to configure the OS to navigate between apps if that's something you're used to.
Also, this is Linux so of course you can easily configure which direction you prefer the scrolling to be and all that, so you can make it behave very similarly to OSx if that's what you're looking for.

Keyboard

Almost everything regarding keyboard keys works as expected from the get go. Keyboard back-light works as expected, and the Media Keys mappings (Play/Pause, Volume, etc) are mapped correctly and properly recognized by media applications. My model has the US keyboard layout, and for this specific one it seems like the backtick and tilde keys output lessthan or graterthan. To fix that, simply create this file /etc/modprobe.d/hid_apple.conf:

options hid_apple iso_layout=0

There's all sorts of tweaks you can make, like swapping the position of keys, changing the default behavior of the fn key, etc. Since this is very particular to each person's liking, I decided to just refer to the proper Wiki entry for Apple Keyboards.

Suspending and Resuming

Oh yeah, it feels good to ditch Caffeine and KeepingYouAwake! :D
It works just how it is supposed to, out-of-the-box with not configuration needed whatsoever. Also closing the lid takes the MacBook to suspension, and when opening it the MacBook wakes up instantly.

Sound

Sound works perfectly. ALSA detects the card as having the chip Cirrus Logic CS4208 and it offers plenty configuration. Sound trough HDMI also works properly and the microphone works great as well.

High Quality Re-sampling trough ALSA is also possible in case you need it, follow the instructions provided here.

Connectivity

Wi-Fi works out-of-the-box, and so does the SDXC card-reader, HDMI and Thunderbolt.

I haven't been able to get Bluetooth to work. I didn't try it that hard as well, mostly because I don't use any Bluetooth peripheral device, and my phone I usually simply connect it via USB cable or Wi-Fi if the first one is not available. Still, I imagine that if I did need Bluetooth I could just buy one of those slim Bluetooth dongles if I wouldn't get the internal one to work properly.

Camera

Camera doesn't work out of the box. It is fairly easy to get it to work though, you just have to install 1 package that installs a reverse engineered driver for the Broadcom 1570 PCIe webcam. I use yaourt for installing packages from the AUR, if you use another simply replace the command line with the appropriate one:

$ yaourt -S bcwc-pcie-git

It works reasonably well, but there yet comparing to how it works on OSx. You cannot properly suspend the computer if the camera is in use for example, and image quality is not as good. The green led still indicates when it is working as that is controlled by the firmware, and the camera also reacts properly to changes in light and all that.

Graphics

All the CPU/GPU of the MacBook Pro's of 2015 are well supported on Linux. To get full GPU acceleration and accelerated video decoding you simply have to install the respective driver and software (be sure to enable multilib repository on pacman configuration file, since we are running in a x86_64 system) :

# pacman -S xf86-video-intel mesa-libgl lib32-mesa-libgl mesa-vdpau

Video performance on Linux is generally faster than OSx, although to be fair the MacBook is not a gaming rig so it won't make a huge difference on daily usage.

If you setup everything correctly, you should get the following output from glxinfo | grep Accelerated:

Accelerated: yes

Note: glxinfo can be found in the mesa-demos package.

Other Hardware

It is possible to use the Apple Remote (infrared) with LIRC, this is something I'vent tested but the device seems to be listed so I assume it works correctly. More info here.

A happy consequence of the switch is that I was able to use a SteelSeries keyboard I had laying around which I really like but unfortunately properly work on OSx even with Karabiner.

Battery

When it comes to battery life, Linux is surprisingly quite comparable to OSx. I can usually get an entire afternoon worth of work. I work mostly with Android Studio which is probably the most CPU-intensive task, while at the same time listening to music and doing the usual amount of web browsing. I'm usually with my phone connected which also drains a bit of battery.

I've recently used my laptop until it reached 5% battery and took a glimpse at energy consumption. The following charts are representative of a 12 hours span, the laptop was disconnected from the power outlet during 6 and a half hours before battery completely ran out.

Performance

Hard Drive

The MacBook Pro has some really decent hardware. Hard drive is an SSD, which has a very decent performance out of the box. Best option for SSDs is to use a filesystem that support's TRIM, so I choose EXT4 and added the relevant tweaks to fstab.

Enable TRIM on the SSD with the discard option for EXT4 filesystems. Example /etc/fstab :

UUID=name_of_device  /  ext4   rw,noatime,discard  0 1 

Another thing that you might do here is add the flag noatime to fstab, but keep in mind that what this does it to not save the access time to files. This reduces the amount of writes to the storage, and thus increases performance and since we're talking about an SSD it also means increased lifetime for the hardware.

If you are using a Swap and it resides on your SDD, you might also want to tell the system to use it less often than usual. Edit file /etc/sysctl.d/99-sysctl.conf and change the value to 1:

vm.swappiness=1

Compile Flags

Most software on Arch is available in binary format, and unless you're a developer that's probably what you'll end up using most of the time. But if you rely on the AUR a lot there are some packages that require to be compiled on the machine. It is all automated, and by default it is well optimized for x86_64 machines. You can add specific flags that will be used as the default ones for each compilation (packages may still override them). It is worth noticing that various extra compile flags are very package-specific, and it this is something that constantly evolves with GCC itself. Fortunately GCC has an option to detect and enable safe optimizations (read, optimizations that are guaranteed to have a an overall performance gain). To enable them, edit file /etc/makepkg.conf and replace march with native and remove mtune. You might also uncomment the -j2 and change it to -j4, this will make multi-threaded compilations on the 4 CPU cores which result in faster compilation times. After you've done so, the changed lines on your file should look something like this:

CFLAGS="-march=native -O2 -pipe -fstack-protector-strong"
CXXFLAGS="-march=native -O2 -pipe -fstack-protector-strong"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
MAKEFLAGS="-j4"

Conclusion

I've been using Arch as my primary OS on the MacBook for a while now and it feels like a first class citizen. No operating system is without it's rough edges, so in the end it all comes to what you like using. Having used Linux in a lot of different computers I can say that it doesn't feel very different from those, and I saw no blockers for using it daily on the MacBook Pro.
I kept a separate partition with OSx, not only because I do some iOS development from time to time but also because firmware updates will come trough Apple updates, so I recommend everyone doing that as well.

Extra information

Be sure to check out the wiki entry about MacBook's on the Arch Wiki. As usual their documentation is one of the best resources out there.


Have a question or related info you want to share? Leave it in the comments below, or reach out to me trough one of my contacts ;)