This is the tale of my adventures installing Arch Linux on a Retina MacBook pro and dual-booting with OS X.
Preparation
Make sure your system is backed up with Time Machine before attempting this. I take no responsibility for you losing your precious cat pictures if this messes up.
The first thing you need to do is grab a current copy of the installation media. This can be downloaded here. Once the ISO is downloaded, you should burn it onto a spare USB flash drive using the following commands in the OS X Terminal:
diskutil list
find the USB drive that you want to burn to. For me it was /dev/disk3 Make sure you type the correct disk number in the next command.
diskutil unmountDisk /dev/disk3
This will copy the ISO you downloaded onto the flash drive. This is a destructive process, so make sure you save the important files on the drive, since they will be erased.
sudo dd if=archlinux-2015.04.01-dual.iso of=/dev/rdisk3 bs=1m
Partitioning the drive
Since we want to dual-boot our computer, we'll need to resize the OS X partition on the SSD and create a partition for the linux install.
You'll need to disable FileVault disk encryption in order to do this. It can be re-enabled after you resize the partitions
Open Disk Utility on your Mac.
Select your SSD on the left, go to the partition tab, and resize your Mac partition. Then create a new partition that is FAT formatted.
I was also able to do this using the command line as follows
diskutil resizeVolume /dev/disk0s2 225G MS-DOS "BOOT" 128M MS-DOS "ARCH" 0b
This resizes the volume disk0s2 to be 225 GB and creates a 128M boot partition and a linux partition that fills the rest of the space.
Booting from the USB
With the USB inserted in the laptop, restart it while holding the 'option' button. Select the USB drive and boot, choosing "Arch Linux" from the menu.
Once you get to the root prompt, you can increase the console font by typing setfont sun12x22
into the prompt.
Internet
Either use a Thunderbolt Ethernet adapter, which should work automatically, or you'll have to compile broadcom-wl
to get WiFi drivers. Refer to the Internet section on this page for more information.
Formatting disks
I created a boot partition and a system partition. You may do this other ways if you'd like.
Install dosfstools
to be able to format the boot partition FAT32
pacman -S dosfstools
I formatted the boot partition FAT using
mkfs -t vfat /dev/sda3
then formatted the system partition EXT4 using
mkfs -t ext4 /dev/sda4
then mounted them by running
mount -t ext4 /dev/sda4 /mnt
mkdir /mnt/boot
mount -t vfat /dev/sda3 /mnt/boot
Installation
If you have any issues with this part, take a look at the Arch Linux Installation Guide
Selecting mirrors
Make a backup of your current mirror list by running
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
Then uncomment all the mirrors (optional)
sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.backup
Then run the rankmirrors
command to find the six fastest mirrors (this might take a while)
rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
Installing base packages
Use this command to install the base packages to your system.
pacstrap /mnt base
Configuring the system
Generate an fstab
file like this:
genfstab -U -p /mnt >> /mnt/etc/fstab
Chroot into the new system
arch-chroot /mnt
Set a hostname and time zone
echo Ian-Laptop-Arch > /etc/hostname
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Edit /etc/locale.conf
and enable your locale then run locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
Set your console font
echo FONT=sun12x22 > /etc/vconsole.conf
You’re going to modify your /etc/mkinitcpio.conf file to insert “keyboard” after “autodetect” in the HOOK section. Then run this to create the initial RAM disk
mkinitcpio -p linux
Set the root password
passwd
Setting up the bootloader
First install the grub
package from the Arch repositories
Modify the following line in /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libata.force=noncq"
Let's set up the boot directory to work with Apple's bootloader:
cd /boot
mkdir -p System/Library/CoreServices
touch mach_kernel
Then run the following commands to create a boot.efi file
grub-mkconfig -o /boot/grub/grub.cfg
grub-mkstandalone -o /boot/System/Library/CoreServices/boot.efi -d /usr/lib/grub/x86_64-efi -O x86_64-efi /boot/grub/grub.cfg
Put the following in a new file at /boot/System/Library/CoreServices/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>
Now we must reboot into OS X to 'bless' the disk to make it bootable (replace disk0s2 with your boot partition)
sudo bless --device /dev/disk0s2 --setBoot
If all things go well, you can restart holding option, and boot into your new install.