Alexey's blog

Installing Arch Linux on a MacBook Air 2013

4 minute read Published: 2016-02-23

Why? In short: because it's fun. On a more serious note, because it allows me to use xmonad, tweak it and learn more Haskell. Especially now that I've got the wonderful Haskellbook to help me. I also would like to learn more about Linux and improve my understanding of how it works.

I need to mention that there is a tiling window manager for OS X that is similar to xmonad, called Amethyst, but I like xmonad better.

This post will mostly be a reminder for myself on how I did, but I am publishing it, in case someone else might be trying out Arch on their MacBook.


There are a lot resources written about this particular topic, I'll list the ones I've found particularly useful:

In general, the process goes like this:

mkfs.ext2 /dev/sda4
mkfs.ext4 /dev/sda5
mkfs.ext4 /dev/sda6

mount /dev/sda5 /mnt
mkdir /mnt/boot && mount /dev/sda4 /mnt/boot
mkdir /mnt/home && mount /dev/sda6 /mnt/home

mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi

You might notice I've mounted Apple's EFI partition to /mnt/boot/efi, this was a recommended step for those who want to use rEFInd sometime down the road.

Then I also created a swapfile:

dd if=/dev/zero of=/mnt/swapfile bs=1M count=1024
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile

iPhone tethering

Now here comes the slightly trickier part I had to deal with - setting up the internet connection. By default you might be able to have a wired connection working, but that assumes you having an Apple USB Ethernet adapter.

My only option was a wireless connection. So, to establish it, I had to use the iPhone tethering.

In order to do that, you need to download several packages in OS X, save them on a USB drive/SD card and install them when you're booted in the live Arch usb.

These are the packages I had to install:

So I've put them on an SD card, booted into live Arch usb and did the following:

mkdir /mnt/sdcard
mount /dev/sdb1 /mnt/sdcard
pacman -U /mnt/sdcard/*.tar.xz

where /dev/sdb1 is my SD card.

After that I've enabled the Mobile Hotpost option on my iPhone, plugged it in, then did the following:

mkdir /mnt/iphone
idevicepair pair
ifuse /mnt/iphone

Then I needed to find out the network interface name of my iPhone me by executing this:

ip link

You need to look for the one that's not titled "lo", in my case it was something along the lines of enp0s3, so I executed this command to establish the internet connection:

dhcpcd enp0s3

That's it. After that point I had an internet connection working. Hooray!


Now I've been pretty much following the Arch on Air guide with some minor additions here and there:

pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab

My current fstab looks like this:

# <file system>                           <dir>     <type>  <options>                             <dump>  <pass>
/dev/sda5                                 /          ext4 defaults,noatime,discard,data=writeback   0       1

/dev/sda4                                 /boot      ext2 defaults,relatime,stripe=4                0       2

/dev/sda1                                 /boot/efi  vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro                                                                     0       2

/dev/sda6                                 /home      ext4 defaults,noatime,discard,data=writeback   0       2

/swapfile                                 none       swap defaults                                  0       0

I've replaced the UUID lines with the partition names in this example, so don't be surprised if your fstab looks a bit different.

Next steps

Configuring the system further includes several more steps, starting from step 7 of the Arch on Air guide. Beyond that I recommend checking out the Post-Installation section of the Archwiki. It has some useful advice that can help you get your system running properly.

There are plenty of posts like this one, so I tried to include the configuration specific to my situation. Like I said in the beginning, this post is mostly for my convenience, to remind myself of what I did and what I struggled with. But if it can help someone else, I'd be happy.

Overall, it's not that painful of an experience, but it still takes time and quite a bit of patience. Things will likely break, go wrong or explode in your face. And that's okay, as long as you remember to keep calm and press on.