Installing Linux on an new Mac is getting more and more difficult, especially if you want to keep your MacOS installation bootable. There is two particular factor which makes it a little bit harder. The first one is SIP (system integrity protection) and the second is apples new filesystem, APFS.
This is a walkthrough which helps you install the latest Ubuntu Linux LTS alongside with a new MacOS system. If you don’t want Ubuntu, the process is pretty much the same with any other Linux distribution like Debian, Fedora, CentOS etc.
Step 0: Make sure to have a full backup
As installing linux is formaly not supported on macs, it is very important to make a complete backup of your system before starting the procedure. Either by TimeMachine, or by a third party app like Carbon Copy Cloner.
1. Make at least one empty partition for linux.
The absolute minimum is one partition which you will need, but it’s always a wise thing to consider making separate partitions for the swap and/or your home directories.
You can create new partitions with disk utility which is a GUI application or with diskutil, which is a terminal application. If you not used to command line interface, i recommend using Disk Util. Make at least an 5-10GB partition for your Linux system.
It’s very important to create a new physical partition, and not an APFS container! If you can’t create a new partition, you might need to disable local timemachine backups. The following command disables it and deletes local snapshots:
sudo tmutil disable
tmutil listLocalSnapShots / | cut -d '.' -f 4 | xargs -n 1 sudo tmutil deleteLocalSnapshots
Don’t forget to re-enable it after you done with the partitioning (if you need local snapshots on MacOS)
sudo tmutil enable
It is okay to format your partitons to MS DOS FAT, because you can reformat it to ext4 or anything else during the installation.
2. Install refind bootloader
While grub is a very good bootloader, i think refind is much more easier to use.
Because of SIP, the installation of refind is a bit more complicated.
– First download the latest refind and unzip it somewhere on your system disk. Write down the exact location and directory name where you unzipped it.
– Restart the mac holding CMD+R while it boots.
– when it started, open terminal from the utilities menu
– now you need to find the unzipped refind folder. If it is in Downloads, you have to type something like this:
/Volumes/Macintosh\ HD/Users/[YOUR USERNAME]/Downloads/refind-bin-0.11.3/refind-install
Don’t forget to replace [YOUR USERNAME] with your actual username (without brackets) and check if your refind version matches the name of the directory. Follow the instructions of the installation procedure and restart your mac normally.
3. Install linux
The last step is installing linux on the newly created partition. I highly recommend making a bootable usb drive with etcher or unetbootin. Reboot your computer with the newly created usb disk pluged in.
Choose the USB drive from refind’s drive list.
When the installer starts, never, ever select “remove everything” or anything like this, if you will need the original MacOS partition. In Ubuntu you need to choose “something else”. Set up your newly created MS DOS partitions to format as ext4 or similar, set their usage and mount points.
If you have only one partition, you need to set the mount point to /, and format it as ext4 any other filesystem your system can be installed to. If the installer asks, choose NOT to install grub bootloader to /dev/sda, choose instead the partition you will mount as /.
Make sure to not touch any of MacOS’s partition! Only the ones you just created.
After the installation completed, and it reboots the system, you will see the newly installed linux system in the refind bootloader.
For fully utilize the capabilites of your hardware, you might need to install some closed source drivers.