I recently decided to run Kali Linux on my MacBook. I originally thought I'd just build it into a Virtual Machine (using Parallels), but was concerned that I might not have the control over the hardware that I'd need in order to make Kali effective as a learning environment. So, I set about working on a dual-boot scenario. Needless to say, I failed miserably when I opted to have Kali install Grub and it overwrote my primary Boot Manager on the Mac and rendered the system unbootable (and eventually unrecoverable). Thank goodness for good backups...
Let us boil it down to 5 links. Follow your favorite topics, sites and people, and we’ll put together the most relevant new links for you. 5 links every day. More than 6000 sources available for following, from big publishers like The New York Times, The Wall Stress Journal, The Guardian to expert publications like Stratechery. HowTo install rEFInd 0.10.4 on your MacBook Pro 13,2 (2016 with Touch ID) running on Mac OS Sierra. Create a directory called REFIND in the EFI volume at /EFI/REFIND Copy the right files. All paths are from the root of the rEFInd directory that you downloaded and all the files go into the directory you just created. Removing REFIND from Mac. GitHub Gist: instantly share code, notes, and snippets.
WARNING: Do not proceed with any of these steps unless you have the ability to restore a bare-metal backup. Everything I'm doing has the potential to trash all of the data on your computer, requiring a clean installation of macOS and subsequent data recovery from backups. I use a combination of Time Machine, CrashPlan, and Arq to back up my system, you should too.
Triple Boot the Right Way
REFInd is a boot manager that will allow you to choose between Mac OS X, Linux, Windows, and other operating systems when you boot your computer. Installing rEFInd makes the dual-boot process easier. (Some older how-to’s will instruct you to use rEFIt, but it’s no longer maintained. REFInd is a currently maintained boot manager based on rEFIt.).
If you're interested in triple booting your MacBook Pro, and Windows is going to be one of the Operating Systems you're going to boot, then take my word for it, this is the only way you want to accomplish this feat.
At a high level, the process goes like this:
- Install Apple's Bootcamp and use it to install Windows 10
- Use Windows 10 to shrink the Bootcamp partition, freeing up space to install Linux
- Install Linux (I used Kali) into the newly freed space
- Install rEFInd as a Boot Manager for all 3 OSes
To be fair, a lot of my instructions and the guide I initially followed, can be found here. However, several of the steps in that guide I didn't have to use at all, so I'm documenting my process here.
Install Apple's Boot Camp
Apple provides a supported method of installing Windows as a dual-boot option for Macintosh owners. There are several advantages to using Apple's process:
Refind Macbook
- Apple supports this as a way to boot Windows
- Apple provides native drivers for the hardware under Windows
- You will have supported ways to control the Windows and macOS boot process on your MacBook from within Windows (via the Boot Camp Control Panel)
Apple's official documentation for Boot Camp is found here.
Follow Apple's instructions for installing Windows, but make sure you create the Windows partition approximately 64GB larger than what you want to end up with for Windows, that space will end up being given to Linux. Adjust if you wish, I used a 196GB partition for Windows 10, then split it into 128GB for Windows and 64GB for Linux (FYI, a Windows 10 installation with Office 365 installed takes up 68GB, so give yourself enough room under Windows).
Note: Apple only supports Windows 8.1, or newer, for hardware released after 2014. There is no way to install an earlier version of Windows using Boot Camp on newer hardware. See this table to check your hardware and what versions of Windows are supported on it.
Now that you have an Apple-supported dual-boot system running macOS and Windows 10 (presumably), it's time to perform the Linux installation.
Create Partition for Linux
For the purposes of this article, I'm going to install Kali Linux, that's what I used, but installation with ANY version of Linux should work the same way.
The first step is to shrink the Windows partition to make some space for Linux:
Refind Mac Install
- Boot into Windows 10
- Right-click on the Start Menu and select Disk Management
- Select the BOOTCAMP partition, right-click and select Shrink Volume
- Enter the size, in megabytes, by which to shrink the volume. I shrunk mine by 64GB, so I entered 65,536
This image is AFTER I did my initial shrink and subsequent installation of Kali linux, you'll have fewer partitions when you do this. I also have an SD card mounted.
The shrinking process took a LONG time (~30 minutes), don't worry about it, let it run to completion and do not interrupt.
After the Volume shrinking process is completed, it's time to download some files to perform the installation; however, you probably want to do this under macOS, so first boot back to your macOS volume and the download them both:
- Kali Linux, 64-bit, can be downloaded here
- rEFInd, can be downloaded here
Place all of the rEFInd files (after unzipping) on a removable volume (SD Card, USB drive, or even a secondary HFS+ volume) so you can use it in the next step.
Install rEFInd
For all macOS versions starting with El Capitan (10.11) Apple has enabled System Integrity Protection (SIP). This security feature of macOS prevents changes to various areas of the Operating System including System-owned files. That means that you cannot install rEFInd directly on drives where SIP is enabled. In order to install rEFInd you will have to boot into Recovery. Make sure the rEFInd files are available on a drive that macOS can see and use, then follow these instructions:
- Reboot the computer and hold down Command-R
- Once in Recovery mode select Terminal from the Utilities menu
- Find the volume where you have rEFInd stored (start with ls /Volumes)
- Change into the rEFInd directory and run ./refind-install
- You will still get a warning that SIP is enabled, but you can ignore it (SIP is enabled on the boot volume, but you're not installing it there
Full installation instructions can be found on the rEFInd site.
You may also want to theme rEFInd to look more 'mac-like'. I used the OSX Standard Theme 1.0 found here. Upate 20200906: This theme's installation instructions ask you to 'replace the EFI folder' in the rEFInd install you just did, it ALSO replaces the more curent version of rEFInd and the cryptographic keys that were provided. You probably shouldn't do that, though your milage may vary on getting this to work. At the time of this article's original publication, they were both the same version, but now, 3 years later, the theme's version of rEFInd is woefully outdated. Use with caution or update the components in the theme with the newer versions. (thank you Phillip!)
Test that rEFInd is installed and operational. Just reboot and you should be taken to the rEFInd boot menu, from there you should be able to boot into either macOS or Windows 10.
Note: rEFInd will automatically find what it believes to be bootable volumes. They probably all won't be bootable, through trial-and-error you should be able to find the correct macOS and Windows 10 volumes. You can then configure rEFInd to ignore some volumes, but save that for after you have everything working properly.
Install Linux##
Boot into macOS and have a USB key available to be reformatted, it can be pretty small (small works better), an 8GB drive is perfect.
In order to create a bootable USB drive, you can use the Terminal:
- Run the Terminal from the Utilities folder under Applications
- Change the directory to where you downloaded the ISO for your Linux installation, e.g. kali-linux-2016.1-amd64.iso
- Find your USB key by running: diskutil list, note the drive name, e.g. disk2
- Run the command: dd -if=kali-linux-2016.1-amd64.iso -of=/dev/disk2 bs=1m
- The above command will take a long time to run, as it is imaging the ISO onto the USB drive. Once it finishes you should have a bootable USB key for Kali Linux (or whatever)
Alternatively, if you want a graphical imaging process, you can use UNetbootin as documented here for Ubuntu (just use Kali or whatever image you want).
You're now ready to install Linux. The reason you had to install rEFInd before installing Linux was that, in my experience, I could not get the standard macOS boot manager to recognize the USB drive I had prepared with Kali Linux. However, if you reboot now, you'll see the rEFInd boot menu. You can then insert your USB drive, then hit ESC to refresh the volumes and you should see the Linux installation drive appear. Select it for booting.
Follow the instructions for installing Linux, making sure to select the correct partition that you created while you were under Windows 10 earlier.
Completed
You should now have a triple-booting MacBook Pro. Using rEFInd you can select the appropriate OS and it should boot cleanly on your hardware.
In the event that rEFInd gets clobbered (you'll know, because a power-cycle takes you to the built-in macOS boot manager) you should still be able to boot into Windows, but you'll probably lose the ability to boot into Linux. Just follow the instructions and re-install rEFInd again and it should come back and allow you to boot again.
Disclaimer: This has the potential to destroy all the data on your drive. Make sure you have adequate (and verified working) backups before you proceed. You have been warned!
That being said this should leave all of your data untouched.
Background:
I have a mid-2012 15” non-Retina Mac book pro with a 1TB hard drive. I decided that I wanted to make my system faster by replacing the hard drive with an ssd and while I was at it I decided I also wanted to have Windows and Ubuntu partitions. Doing it this way meant that I had no data on the SSD while I experimented with partitions and boot managers although everything I did should be possible on a drive with an existing system.
Goals:
- Multiple OSs installed with the ability to add more
- A nice, manageable boot loader
- Full disk encryption for macOS using filevault
Requirements:
- A Mac running a recent-ish version of macOS
- A linux ISO or install disk (Any should work but I picked Ubuntu Desktop)
- A windows iso or install disk
- An extra flash drive (may not be needed but can be very useful)
- A macOS installer for your chosen version of macOS (can be downloaded from the App Store)
- A second computer (again, may not be needed but also might be essential for troubleshooting)
- A copy of rEFInd
- a wired internet connection (in my experience this was necessary in order to get wifi working on Ubuntu but you mileage may vary)
Part 1: Installing rEFInd
These instructions assume an x86_64 architecture, if you for some reason have something different then you will need to pick a different set of files to copy across.
- Disable System Integrity Protections: this sounds bad but in order to mess with the EFI boot loader you have to do this.
- Boot into recovery mode
- Open terminal
- Run the command:
csrutil disable
to disable SIP
- Mount the EFI partition.
mkdir /Volumes/ESP
mount -t msdos /dev/disk0s1 /Volumes/ESP
- Create a directory called
REFIND
in the EFI volume at /EFI/REFIND - Copy the right files.
All paths are from the root of the rEFInd directory that you downloaded and all the files go into the directory you just created.- refind/drivers_x64/
- refind/icons/
- refind/refind_x64.efi
- refind/tools_x64/
- Copy the sample config file to the same place as the other files and rename it to
refind.conf
- Bless rEFInd.
bless --mount /Volumes/ESP --setBoot --file /Volumes/ESP/EFI/REFIND/refind_x64.efi --shortform
Part 2: Partitioning
Note: For reasons best know to itself, Windows refuses to install on a partition numbered higher than 5 (eg. disk0s5
). MacOS wil be installed in one of the first partitions since it is already installed and linux doesn’t care where you install it to. Don’t worry about accidentally removing the recovery partition, you can get it back later and removing it my make it easier to get windows to install.
Part 3: Windows
I felt that windows was the most likely to cause problems so I decided to do it first to minimize my losses if it failed and wiped everything.
Boot Camp drivers
In order for windows play nicely with mac hardware you need to install the bootcamp drivers.
- Open Boot Camp Assistant and click continue.
- On the second page select the option to download the latest Windows support software from apple an follow the instructions. This shouldn't do anything to your hard drive.
Installing Windows
- Restart the machine to get to the rEFInd menu
- Insert the Windows install media and press escape to make reFind regenerate its list of boot options.
- Select the Windows installer.
There will probably be two options where one of them is labled legacy. I have always avoided the legacy options and had good experiences so I would recommend picking the other option. - Once inside the installer, select advanced/custom install
- Select the correct partition and reformat it to ntfs.
If it then complains about the partition table just restart the machine and it might work the second time. If not then you could try repartitioning the drive again. - Finish the installation then install the bootcamp drivers once windows has booted
- Fix rEFInd
Part 4: Linux
The Linux installation process is similar to windows but it doesn't care which partition it is installed into. The exact process will vary between distributions but you will probably want to select the advanced option to make sure it only touches the correct partitions. If there is an option, I would recommend enabling proprietary drivers as this may help make wifi work. After the install is finished you will need to fix rEFInd again.
Part 5: Filevault
Try enabling it normally. (Hey, it might work, who knows!)If it complains about a lack of recovery disk then complete the section on recreating the recovery partition and try again.
Fix rEFInd
Whenever you install a new OS or somtimes when you install updates, one of the operating systems may decide that you EFI boot selection is all broken and that it needs to be fixed. When this happens then when you reboot it will boot straight into that OS and skip rEFInd. Instructions for how to fix this are below and there is a script in the attached file.
- Restart and hold down the option key.
This tells the hardware to skip straight to the mac bootloader, allowing you to bypass your broken EFI settings. - Select your macOS partition to boot from.
- Open terminal
- Mount the ESP volume:
mkdir /Volumes/ESP
mount -t msdos /dev/disk0s1 /Volumes/ESP
- Bless the reFind program
bless --mount /Volumes/ESP --setBoot --file /Volumes/ESP/EFI/REFIND/refind_x64.efi --shortform
Everything should be fixed now and rEFInd should work as normal
Recreate Recovery Partition
- Download the Recovery Partition tool
This tool is very simple and does exactly what it claims to do. The only downside in my experience is that it gives no indication of progress. - Run it. You may need to provided it with an installer for your current version of macOS.
- Check to see if it worked.
Restart and hold option. If it worked you should see an option to boot into recovery mode.
What Next
Refind Mac Download
If you got this far then you should still have a working macOS install and in addition you should now be using rEFInd and have one or more other operating systems installed. At this point adding, removing, or changing which OSs you have should be fairly simple and rEFInd should automatically detect them. From time to time installing updates will break you rEFInd configuration but when that happens just follow the instuctions to fix it and everything should be ok. Unfortunately System Integrity Protections are still disabled but if they are enabled again they will make it impossible to fix rEFInd and may break things.
References
Refind Mac
- rEFInd By Roderick W. Smith
- Recovery Partition by Christopher Silvertooth
- Probably a few other guides that I have since lost the links to