Skip to content

Instantly share code, notes, and snippets.

@bthuilot
Created October 31, 2017 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bthuilot/fa4a66bc297f7ae8a9d105fc48c625bb to your computer and use it in GitHub Desktop.
Save bthuilot/fa4a66bc297f7ae8a9d105fc48c625bb to your computer and use it in GitHub Desktop.

Arch on Mac 2017

As of November 2017

Using Macbook 14,1

Introduction

This is a guide to installing linux on the newer macbook 2017 models. I am personally using the 14,1 model but this will also work for the 13,1 models. As for anyother 13, x or 14,x models, check this repository for more specific instructions. I should also say that the repository previoulsy mentioned was a huge help in installing and is maintained by people who are actively trying to make the new macbook work, to the full extent, on Linux. If you encouter any issues that you cant resolve by google searching, try asking there.

Installation Process

Step 1 - Getting the materials ISO and Booting

This part is easy.

  1. Get a usb, Ethernet port, external usb keyboard
  2. Download the ISO from Arch Linux's website
  3. Either use dd on a mac or use Etcher to write to the usb
  4. Done!

Step 2 - Using rEFInd

I highly recommend using rEFInd as a boot manager because it will make it all so much easier. You can choose not too but why would you? rEFInd is pretty easy to install but I will guide you through it

  1. Download the binaries. Choose the ZIP option for download
  2. Unzip the file in your home directory (the one that is your username).
  3. Open terminal and cd into that directory
cd refind-bin-x.xx.x
# x.xx.x being your rEFINd version
  1. From there run the command below. It might ask for your password. If you get an error about System integrity scroll down a section to see how to deal with that.
./refind-install
  1. CHECK NOTE ABOUT ERRORS You're all done! restart your mac to see the boot menu when it starts up. You can also get themes for rEFInd I recommend minimal, minimal-black or, my personal favorite, ambient.

NOTE ABOUT ERRORS

For some reason on newer macs the boot manager doesn't pick the right Preboot volume when it first starts up. If you get an error about invalid image or just something about not finding something, just reboot and press the escape key and choose the new one that appears.

Turning off System Integrity Protection (SIP)

Fairly simple, restart and boot into Recovery mode (hold Cmd+R while computer is booting up). Click on Utility tab, launch terminal and type

crsutil disable

Step 3 - Partitioning Hard drive

This where you need to decide how much storage to give your linux partition. You need to give at least 20Gb I would say but it depends on what you want to use it for and how much you have. Once you pick your amount open Disk Utility. Click on the APPLE SSD or whatever the name of your internal hard drive is and click the partition button located in the center on top. Then click the + button and type in you size you want. Name it anything (doesn't matter going to be overwriting) and make it an MS-DOS type for now. Should take a little bit. If it says error just click okay then retry it 99% of the time it will give an error and then work the second time.

Step 4 - Installing Arch

Okay this part is pretty hard, if anything on hear isn't explained well check out these two pages: Installing Arch and Installing Arch on Mac or just google what your confused about

  1. To start turn off the mac and plug in the usb and the ethernet. Then reboot and choose the usb from the rEFInd screen (should either be a question mark or 4 diamonds or the arch logo) There might be multiple options, if thats the case choose one and if there is an error somewhere in the installation try choosing the other the next time

  2. It should take a bit but eventually boot into a shell where it will display root@arch# in RED TEXT. If its not red there provably was an error booting to the usb. If there was multiple options for the usb on the rEFFInd, restart and choose another. If the error still persists try either rewriting the usb using dd, changing the usb you are using or just google it. If it still doesn't work get someone who knows that they're doing.

Okay now it gets a little complicated

  1. If the keyboard isn't working This is normal you'll need to install the drivers later so for now simply plug in a usb keyboard and use that (if it doesn't work when you plug it in try restarting)

  2. start by making sure the ethernet is working, do this by typing

dchpcd

then followed by

ping -c 4 google.com

You should see that you got responses from the server. This means its working.

  1. The next step is partitioning the hard drive. WARNING: Be careful doing something wrong is this part could delete your mac partition. So either back up your data or make sure you know what your doing. Now to begin type in
fdisk -l

This list out all your disks, look for the one that is yours, should be the size in GB that your mac comes with (or at least close to it). if its a newer mac it should say /dev/nvme0n1. To being the partition type in

cgdisk /dev/nvme0n1 #Should use your disk

You should then be in a selector for the partitions on the disk and get an output of all of your partitions we are going to add 3

  • boot (~256Mb)
  • swap (~1/2 Ram: for me 8G)
  • root (The rest of the storage your willing to give it) You should look for the partition labeled Microsoft Data and delete it, it is the partition we created earlier From there make the new 3 partions with their respective sizes listed next to it. for root give it the rest of the free space.
  • Side Note when it asks for the starting sector, just press enter. label them what they are labeled up there. Once you are done, click write, type yes then exit.
  1. We now need to set up the file system for install start by typing
fdisk -l

again and look for the /dev/xxxx partions for Linux filesystem, Linux swap and EFI System IMPORTANT: From here on if I reference the EFI partition I am talking about the 256M one, the first one thats 300M is the apple one, DO NOT TOUCH THAT. After checking the partition numbers we need to format the file system and swap (should most likely by /dev/xxxxx5 and /dev/xxxxx4 respectively but can be different) run the following commands

mkfs.ext4 /dev/nvme0n1p5 # Your file system
mkswap /dev/nvme0n1p4 # Your swap
swapon /dev/nvme0n1p4

NOTICE I will now be using

  • /dev/nvme0n1p5 for Linux Filesystem
  • /dev/nvme0n1p4 for Linux Swap
  • /dev/nvme0n1p3 for EFI System (again make sure you use no NON-APPlE one, I will not be reminding anymore in this tutorial)
  1. We will now mount the file system. run
mount /dev/nvme0n1p5 /mnt
mkdir /mnt/boot && mount /dev/nvme0n1p3 /mnt/boot

Now its time to install

  1. Simply type
pacstrap /mnt base base-devel

and let it run

after its done we need to generate an fstab file, do this by typing

genfstab -p /mnt >> /mnt/etc/fstab

Initial Configuration

  1. We now login into the installed system using
arch-chroot /mnt /bin/bash

The following commands will help set up system

# set a host name, replace your_hostname_here
echo your_hostname_here >> /etc/hostname
\
# Set up your time zone, I live in Boston so I just used New York
ln -s /usr/share/zoneinfo/America/New_york /etc/localtime

#Set hardware clock
hwclock --systohc --utc

#Create User account, replace your_name
useradd -m -g users -G wheel -s /bin/bash your_name && passwd your_name

# Create root password
passwd

# install sudo
sudo pacman -S sudo

Your should then edit the sudo file by typing

visudo

And remove the comment infront of the first wheel line Set up locale by editing locale.gen with

sudo nano /etc/locale.gen

and uncomment the line with your language, en_US.UTF-8 and en_US ISO-8859-1 for United States. Then type

locale-gen
# Then export
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

Finally run

mkinitcpio -p linux

Bootloader Config

Keyboard

  • install dkms
  • clone guys repostiory
  • mkinitcpio
  • dkms
  • install kernel headers
  • mod whatever

Wifi

  • Driver comes with it
  • nm-applet
  • standalone tray

i3

  • Install xorg xinit gdm
  • service gdm start
  • install i3
  • Polybar

Resoltuon

  • Xinit setting dpi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment