Installing Ubuntu Linux on my MacBook Air
April 23, 2020
My only computer right now is my MacBook Air, a 2013 model. I recently upgraded its internal storage from the impossibly-cramped 128GB SSD that it came with to an aftermarket 1TB NVMe drive from Crucial. (That’s its own whole saga; this thread is the definitive resource on how to do this.) While this has been working decently well for a couple of months, I’ve started to get increasingly frequent kernel panics related to the storage drivers. So, naturally, I decided to install Linux (Ubuntu 20.04 LTS) and see if that worked any better.
It mostly works. Notable things that I figured out through this process:
- you can mount your APFS Mac partition read-only on Linux, even if it’s encrypted, with this tool. The required package names didn’t exactly match the package names in Ubuntu 20.04, but it wasn’t too hard to figure out - I think I needed to install
libfuse3-dev
andlibz-dev
, but didn’t need to installgcc-c++
. After getting the APFS FUSE thing built, I set up a little alias to mount my Mac partition, like so:
macmount () {
sudo mkdir -p /mnt/mac && \
sudo $HOME/bin/apfs-fuse \
-o 'uid=1000,gid=1000,allow_other' \
/dev/nvme0n1p2 \
/mnt/mac
}
- the default color profile looked really bad, but this is fixable. I found and installed this profile of unknown provenance (settings > colors > laptop screen > add profile), and now colors look much closer to how they looked in macOS.
- to get
pbcopy
/pbpaste
-ish functionality, usexclip
, perhaps with aliases like these. - to use your Caps Lock key as Esc, run
localectl set-x11-keymap "" "" "" caps:escape
. This doesn’t seem to be working perfectly in VS Code, however, so more investigation will be necessary.- update: you need to set the
keyboard.dispatch
setting tokeyCode
for remapped keys to work correctly. See this thread.
- update: you need to set the
- I’m 99% sure you don’t need to install any third-party boot managers or anything like that: I’ve just been holding down Option at startup to choose the OS to use, and it’s been working so far.
- To get the webcam to work, you have to go through all of this kernel module rigamarole.
- I missed having a global hotkey to launch iTerm2, so I wrote this script that checks if there’s an open gnome-terminal window, switches to it if so, and opens a new gnome-terminal window if not.