Running Linux on my Macbook
This is another one of those posts, the one’s where Linux desktop apologists have the urge to justify to the world why they do things.
So here we go, a few weeks ago I installed Fedora 32 on my Macbook Pro (early 2015 model). In this post I hope to document the pitfalls, traps and joyous moments I found along the way, complete with the annoyances that I’ve come to tolerate.
I’ll preface this post by saying most of the issues encountered are down to the minimalist nature of the setup I’ve gone with. So don’t take this as a reflection on Fedora/Linux, I suspect the defaults with GNOME come with a lot less footguns.
The main reason for the switch was one killer app; the i3 window manager. Keyboard shortcuts, tiled windows, lightning fast to use – it feels like a piece of software designed for people who tinker and use computers a lot.
..and it’s generally been a joy to use. My favourite feature is the “scratchpad” where you can bring up and dismiss a window in the same workspace via a keyboard shortcut. This has been an absolute blast with some custom note taking software I wrote, which I mount via FUSE. Writing notes is a joy because the context switch is minimal.
The meteoric rise of the web browser as a platform has made me realise that I don’t really use that much native GUI software anymore. All I seemed to use on OSX was a web browser, Visual Studio Code and a terminal with lots of CLI/TUI software configured via a set of dotfiles.
I’m a huge gamer at heart but I’m fortunate enough to own a beefy gaming PC and a set of consoles to meet that need, so I can’t really comment on Linux support on that side of things.
So switching OS’s isn’t really that much of a barrier for most of my use cases.
Installation was a bit of anxiety inducing to start with, for one thing I didn’t want to screw up the boot partition of my Mac just in case things went a bit wrong and it took a while to search about ways to do this cleanly.
Thankfully Alex Dzyoba wrote an excellent article on creating the appropriate partitions for dual booting.
Once that was done it mostly just seemed to work. Wi-Fi worked, sound worked, so I installed i3, applied my dotfiles and got going.
The first issue I encountered was trying to get the keyboard settings to work with the Macbook layout, especially on a GB localised keyboard and tuning it to recognise that I like Caps Lock and Ctrl to be switched.
This was solved with
setxkbmap which you have to run on login:
Additionally, sometimes I throw my laptop onto a desk and plug it into an external keyboard (not Apple branded) and this also needs additional tuning when I plug it in as the alt/windows keys are swapped for some reason.
This took a while to reach those settings but I’m happy with them.
The copy and paste problem
Moving from OSX to Linux means throwing away 10 years of muscle memory on keyboard shortcuts. Cmd+C, Cmd+V for clipboard just won’t work without a lot of tinkering that just didn’t seem worth the effort to me. Pull off the band aid instead, it’s got to happen some time.
So I’ve had to train myself to go back to using Ctrl as the modifier key, which was tricky at first but it’s amazing how quickly I’ve adapted. The annoying part is having to remember to hit the Shift key when copying/pasting into terminals.
As mentioned previously I often plug in my laptop to an external monitor and like the keyboard tweaking, this took a lot of effort. For one, I position my laptop below my external monitor so like the layout to be above/below. It took me ages to try and find the decent
xrandr settings to support this. Every time I tried the monitor above bled into the laptop screen below.
Eventually I found the excellent tool
arandr which presents a GUI interface to generate the appropriate settings.
Unfortunately I’ve not found a way of automatically applying these settings when unplugging/plugging the monitor so I’ve had to write a script to run when switching (which also includes the
setxkbmap settings described above)
To get everything scaling nicely on the laptop took a bit of effort but thankfully Doug Beney wrote a decent guide which was simple to implement.
It’s easy to take for granted something as simple as changing the brightness on your screen, but it took me a while to figure this out. Thankfully using the guidance in this askubuntu post and setting some i3wm config settings, I was able to make the brightness keys work roughly the way you would expect.
Please just go to sleep
Closing the lid on the laptop should suspend the OS but this just never seemed to work, I’d often find my machine in a state of hot panic the next morning with 30 minutes of battery left.
To solve this, thanks to an excellent post by Josh Sherman, you need to prevent the USB controller from waking up the system.
Unfortunately you need to apply this setting every time you boot so I wrote a systemd service and script to enable this.
This is probably the most depressing part of switching. I’ve been a long time Firefox fan, especially with extensions like Tree Style Tabs that acted as an enabler for my tab hoarding vices.
Unfortunately on Linux it’s just been dogshit, absolute dogshit. Slow, takes ages to start, websites render in really slowly, switching between tabs feels so lethargic it’s like the fire in the fox has gone out.
I’ve tried everything to fix it, changing things in
about:config, trying Firefox Nightly and enabling WebRender but nothing seemed to be working.
In contrast Google Chrome is lightning fast, it really is night and day, so for my Linux forays sadly I’ve had to go with the big G for now.
Other tools and things I’ve setup
After getting everything working the way I like it, it all kinda just works?
i3wm is a blast to use, switching between workspaces, moving windows and getting used to the tiling has been a little bit of a learning curve but it’s meant I’m using my mouse much less.
The additional benefit is just how fast everything feels, it might just be a matter of perception but sometimes perceptions matter.
Note: I’m aware of swaywm that is config compatible with i3 and runs on Wayland. I’ve tried this out and it seems neat, and it would probably solve the keyboard/monitor issues described above, but on my Retina display Chrome just looks really blurry. I’m guessing because it’s rendered via XWayland, once that’s resolved I’ll look into making the switch.
Systemd gets a lot of flak in the community but I really, really like it. I’ve already written a few services of my own that perform tasks or run software, installed under
.config/systemd/user and they were trivial to write.
Getting used to the tooling has been a hill to climb but it feels so much better than the old days of
I use Fedora on other machines in headless mode so I’m fairly used to the tooling, but it’s nice to have a decent package manager that generally keeps everything up to date. Homebrew on OSX is a heroic effort, but it’s just not the same.
WiFi sometimes drops
I’ve not been able to figure this one out, but maybe once or twice a week the WiFi driver will just stop working. To fix it I have to issue a command to reload the kernel module.
I do sometimes use Skype and Zoom to communicate with family members but the webcam doesn’t work out of the box, it looks like there is a reverse engineering effort going on to remedy this, but I’ve found my iPad works as a decent video calling device, so I’ve not gotten around to fixing it.
Browser hardware video acceleration
Web browsers in Linux straight up do not support GPU video acceleration. This became apparent to me when investigating why my laptop was panting, expelling enough heat to cook an egg while watching a YouTube video about…cooking eggs.
Apparently there is a patched version of Chromium out there that supposedly supports it but for the time being it doesn’t look like the browser vendors see this a top priority. It’s a shame but oh well.
Installing VLC and the intel driver works though, so that will have to do.
There are a few things I immediately missed from the OSX world, but there mostly appear to be Linux equivalents or workarounds.
Switching to Linux in my home life suddenly presents a problem at work. The cognitive overhead of alternating between different keyboard shortcuts on different OS’s didn’t seem very appealing, along with the fact that I just knew I’d miss i3.
So to workaround this I use a virtual machine via VMware Fusion which works surprisingly well. A little too well, it feels almost native! My work machine is a MBP 2019 with 6 cores and 32GB of RAM, so it’s more than capable.
There are always compromises to be had, whether it be Firefox performance, lack of HW video decoding in the browser and having to tweak a few things, but overall it’s been a mostly positive experience to switch. I’ll admit that a lot of the issues I came across were of my own making, but it’s been worth it.
I’ve really not missed OSX that much, in fact it’s probably sealed my decision to not go with Apple next time round. The hardware is excellent, but getting Linux running on Macbook models >= 2016 sounds like an exercise in sadness so it might be the end of the road for Apple laptops in my house.