Instructions for installing Arch Linux side-by-side with OS X on a Macbook Air 2013.
Most of this information was taken from these two sources:
1. Make bootable USB media with Arch ISO image (wiki)
The following example assumes Arch will sit on a single partition; adjust according to preference.
It may also be possible to create a data partition that can be accessed from both OS X and GNU/Linux systems: how to do that properly is left as an exercise to the reader.
cgdisk /dev/sda
mkfs.ext4 /dev/sda5
mkfs.ext4 /dev/sda6
mount /dev/sda6 /mnt
mkdir /mnt/boot && mount /dev/sda5 /mnt/boot
This requires an internet connection. Options:
- Tethered phone via USB (easiest IMO)
- Wired (with some Apple proprietary ethernet thing ($$$?))
- Wireless (requires b43 wireless firmware (AUR))
pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab
/dev/sda6 / ext4 defaults,noatime,discard,data=writeback 0 1 /dev/sda5 /boot ext4 defaults,relatime,stripe=4 0 2
arch-chroot /mnt /bin/bash
passwd
echo myhostname > /etc/hostname
ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
hwclock --systohc --utc
useradd -m -g users -G wheel -s /bin/bash myusername
passwd myusername
pacman -S sudo
echo "myusername ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
nano /etc/locale.gen
locale-gen
echo LANG=en_US.UTF8 > /etc/locale.conf
export LANG=en_US.UTF-8
Insert “keyboard” after “autodetect” if it’s not already there.
nano /etc/mkinitcpio.conf
Then run it:
mkinitcpio -p linux
To boot up the computer we will continue to use Apple’s EFI bootloader, so we need GRUB-EFI:
pacman -S grub-efi-x86_64
nano /etc/default/grub
Aside from setting the quiet and rootflags kernel parameters, a special parameter must be set to avoid system (CPU/IO) hangs related to ATA, as per this thread:
GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libata.force=1:noncq"
Additionally, the grub template is broken and requires this adjustment:
# fix broken grub.cfg gen GRUB_DISABLE_SUBMENU=y
grub-mkconfig -o boot/grub/grub.cfg
grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
Copy boot.efi (generated in the command above) to a USB stick for use later in OS X.
Exit everything and reboot into OS X (by holding alt/option) and then choosing it.
exit # exit chroot
reboot
Format (“Erase”) /dev/sda4 using Mac journaled filesystem
This procedure allows the Apple bootloader to see our Arch Linux system and present it as the default boot option.
cd /Volumes/disk0s4
mkdir System mach_kernel
cd System
mkdir Library
cd Library
mkdir CoreServices
cd CoreServices
touch SystemVersion.plist
nano SystemVersion.plist
<xml version="1.0" encoding="utf-8"?> <plist version="1.0"> <dict> <key>ProductBuildVersion</key> <string></string> <key>ProductName</key> <string>Linux</string> <key>ProductVersion</key> <string>Arch Linux</string> </dict> </plist>
Copy boot.efi from your USB stick to this CoreServices directory. The tree should look like this:
|___mach_kernel |___System | |___Library | |___CoreServices | |___SystemVersion.plist |___boot.efi
sudo bless --device /dev/disk0s4 --setBoot
Voila, Arch Linux is installed.
Reboot the computer and hold the alt/option key to select which operating system to boot.
Download and install broadcom from AUR
(Make sure that b43 and ssb modules are not present in the output from `lsmod`)
modprobe wl
Alternatively, install broadcom-wl-dkms instead
…so that kernel updates don’t leave you without wifi. DKMS is a service that recompiles external modules after every kernel upgrade.
sudo pacman -S dkms
sudo systemctl enable dkms.service
sudo pacman -S dialog
sudo wifi-menu -o
The tilde key does not work on the keyboard out of the box. There are several solutions listed here but this one worked for me:
sudo nano /etc/modprobe.d/hid_apple.conf
options hid_apple iso_layout=0
The <insert> key can be reproduced with fn+<Enter>. So to paste in an xterm window for instance, use S-fn-<Enter>.
F1-F12 require fn+<F1>, etc.
Out-of-the-box battery performance on Arch Linux should be good and at least comparable to OS X.
If you want to try to improve battery life, there are two recommended packages documented in the ArchWiki:
- PowerTOP: a tool provided by Intel to enable various powersaving modes in userspace, kernel and hardware, available in the official repositories. (ArchWiki)
- Powerdown: a collection of power-saving scripts available in AUR. (ArchWiki)
There are other folks who have blogged about this process since I started this:
- [Installing Archlinux on Macbook Air 2013 - Frank Shin](http://frankshin.com/installing-archlinux-on-macbook-air-2013/)
- [Arch Linux – MacBook Air 2013 | Ryan Gehrig](http://ryangehrig.com/index.php/arch-linux-on-macbook-air-2013/)