Refind Mac

Note: The installer will copy the refind.conf-sample file to EFI/refind/refind.conf on your ESP partition. If you need to change settings later on, you'll have to mount the partition first (use the first two commands from the uninstall instructions below to mount it.) Reboot your Mac and go back into recovery mode by pressing Command+R.

  1. Refind Macos
  2. Refind Mac Install
  3. Refund Mac

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...

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.

  1. REFInd is a boot menu and maintenance toolkit for UEFI and EFI-based machines. It can be used to boot multiple operating systems that are installed on a single non-volatile device. It also provides a way to enter and explore the UEFI/EFI pre-boot environment using an interactive shell, for example shellx64v2.efi.
  2. Configuring rEFInd boot manager as your startup disk on a Mac. So I’ve installed Ubuntu on the metal of my MacBook Pro Retina (13 inch, if you must know) and in order to dual-boot the machine, I use the rEFInd Boot Manager.

Triple Boot the Right Way

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:

  1. Install Apple's Bootcamp and use it to install Windows 10
  2. Use Windows 10 to shrink the Bootcamp partition, freeing up space to install Linux
  3. Install Linux (I used Kali) into the newly freed space
  4. 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:

  1. Apple supports this as a way to boot Windows
  2. Apple provides native drivers for the hardware under Windows
  3. 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.

Refind Macos

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:

  1. Boot into Windows 10
  2. Right-click on the Start Menu and select Disk Management
  3. Select the BOOTCAMP partition, right-click and select Shrink Volume
  4. Enter the size, in megabytes, by which to shrink the volume. I shrunk mine by 64GB, so I entered 65,536
Refind Mac

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:

  1. Kali Linux, 64-bit, can be downloaded here
  2. 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:

  1. Reboot the computer and hold down Command-R
  2. Once in Recovery mode select Terminal from the Utilities menu
  3. Find the volume where you have rEFInd stored (start with ls /Volumes)
  4. Change into the rEFInd directory and run ./refind-install
  5. 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:

  1. Run the Terminal from the Utilities folder under Applications
  2. Change the directory to where you downloaded the ISO for your Linux installation, e.g. kali-linux-2016.1-amd64.iso
  3. Find your USB key by running: diskutil list, note the drive name, e.g. disk2
  4. Run the command: dd -if=kali-linux-2016.1-amd64.iso -of=/dev/disk2 bs=1m
  5. 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

Refind Mac Install

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.

Refund

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.

You installed Windows on an Intel Mac via Boot Camp, and want to usevirtualization in it. But there’s an issue — hardware virtualization extensionsare not available. Luckily, this can be worked around easily with the help ofrEFInd, an alternate boot manager.

Many software development workflows involve virtualization. WSL, Docker forWindows, and the Android Emulator are some examples of commonvirtualization-based tools. Then there are general virtualizationtools/hypervisors, such as VMware Workstation, Hyper-V or VirtualBox. All thesetools require hardware virtualization extensions (Intel VT-x, AMD-V) or atleast are very slow without them. Virtualization extensions are not enabled bydefault in the CPU, they must be enabled by something. On typical PCs, this isoften a firmware-level setting (that might be disabled by default), or it mightbe unconditionally enabled by the firmware. On a Mac, however, enabling VT-x isdone by macOS, as part of the boot process. This means that Windows running inBoot Camp will start without virtualization, unless you want to boot into macOSfirst and then reboot into Windows. That setup isn’t quite ergonomic (and whatif macOS refuses to shut down, as it often does for me?).

Instead, we’re going to userEFInd, a boot manager forEFI-based systems that can boot into various OSes and also handle otherparts of the boot process. But first, let’s prepare our system for this.

DISCLAIMER: Those steps may make your Mac fail to boot. I don’t take anyresponsibility whatsoever if that happens. Prepare for the worst — makebackups, perhaps have install media ready, plan some downtime.

Step 1. Install Windows in Boot Camp the usual way¶

The first thing you should do is install Windows 10 in Boot Camp, withthe help of the Boot Camp Assistant. The Assistant will take some timeto partition your drive and do other preparations (and show barelyinformative progress bars, but I ranted about that Apple design “feature”already).There are no special preparations for this, the standard process willwork. If you already have Windows installed, you can go to the nextstep.

Step 2. Ensure the setup is stable¶

We’ll be making changes to how the machine boots, and as such, it’sgood to have other things working correctly and in line with yourexpected configuration. Make sure that:

  • Both macOS and Windows boot correctly

  • You can change the OS you boot into by holding the Option key afterpressing Power (requires disabling the firmware password 1)

  • Disk encryption (FileVault, BitLocker) is enabled (if you want that, ofcourse) and fully configured (initial encryption is complete)

  • Windows setup (including Boot Camp drivers) is complete

  • The OSXRESERVED partition that the Boot Camp Assistant createdhas been deleted (that should have happened when booting into macOS for thefirst time after installing Windows — complete with a slowly movingprogress bar and no other information, as is usual for this OS — butif that didn’t happen, use Disk Utility in macOS or Recovery OS to dothat — pick your drive, click Partition and delete the partition,this will grow the macOS partition)

  • System Integrity Protection is enabled (the procedure is a bit saferthat way)

Step 3. Create a partition for rEFInd¶

Refind

First, back up your data before making changes to your hard drivelayout. We’ll need to create a new partition for rEFInd to live on. Thisis the safest option — you could install it to the EFI System Partition (ESP),but macOS might want to put its own stuff there, and it’s safer not touse it.

The rEFInd partition doesn’t need to be large (50 MB will be enough); it must use the HFS+ (Mac OSExtended) file system. To create it, you have three options:

  • From macOS, by shrinking the macOS partition: open Disk Utility,choose your drive, select Partition, add a new partition, set itssize and file system (in that order!). This will take a few minutes(10-15, or possibly more), and you won’t be able to use your Macduring the resize.

  • From Recovery OS, by shrinking the macOS partition: same steps apply,but it might be a bit safer than doing it from within macOS.

  • From Windows, by shrinking the Windows partition: open DiskManagement (press the Windows key and type partition, or openComputer Management from Administrative Tools), right click yourWindows partition, select Shrink Volume. Enter the desired size andclick Shrink. Then, right click the unallocated space and create aNew Simple Volume. For now, choose FAT32 or exFAT; you’ll need toreformat it as HFS+ from within macOS later (Erase in Disk Utility). Thiswill take a few seconds — and even if you include the time to reboot, it’sfaster.

After you create the new partition and make sure it’s HFS+ (Mac OSExtended), you can proceed with the setup. Also, if you don’t want thepartition to be visible in the Finder, run the following command (insertthe correct volume path for your system):

Step 4. Configure and install rEFInd¶

To set ue rEFInd, you’ll need to boot into macOS. DownloadrEFInd from theauthor’s website — you want the file named A binary zip file. Extractthis archive anywhere on your system (~/Downloads is fine).

First, you’ll need to change the configuration filerefind/refind.conf-sample. Locate the setting namedenable_and_lock_vmx, uncomment it (remove the # at the startof the line), and set its value to true. You can also make otherconfiguration changes — the default timeout of 20 seconds islikely to be too much for your needs.

When your configuration file is ready, you can install rEFInd. You canuse the refind-install tool, or perform a manual install (checkout the installationdocs for moredetails).

Before installing, you’ll need to get the device name of your rEFIndpartition. Open Disk Utility, select the partition from the left pane,and check the Device field (for example, disk9s9 — it will bedifferent on your system, depending on your partition layout).

Open a Terminal, cd into the directory where rEFInd was extracted,and run the following command (replace disk9s9 with the devicename on your system):

This command will produce an error if you have SIP enabled — but thiserror is not important for us, the install will work without the changethat SIP prevented. 2

You can now shut down your Mac and use the Option key while starting upto choose the OS. You should see three options: Macintosh HD, EFI Boot,and Boot Camp. The EFI Boot option is rEFInd — pick that, boot intoWindows (Microsoft EFI boot), et voilà — Windows can now run virtualization software.

Refund Mac

There are a few more things that you can do now, depending on your OSpreferences.

  • You can make rEFInd the default boot loader. Hold Control on theApple boot device selection screen and click the Power icon under theEFI Boot drive (source for thetip).

  • You can use rEFInd to boot into macOS, although this might not workwith Big Sur according to the author (it seems to work for me, butYMMV). You can use the standard boot method for macOS (by defaultingto Macintosh HD, or by choosing it from the Power+Option picker) andrEFInd exclusively for Windows (and set your timeout to a low value).

  • You can modify rEFInd’s configuration — in this scenario, the configfile is /Volumes/rEFInd/System/Library/CoreServices/refind.conf.You can set a custom background image, for example (rEFInd’ssite can help you figure outwhat options are available and what you can set them to).

1

If the firmware password is important to you, you can restore it afterthe setup is done — this will mean using rEFInd to boot both Windows andmacOS, although I decided to remove the firmware password and bootinto macOS from the Power+Option boot menu.

2

The failing operation is marking the rEFInd partition bootable in the Macsense, using the bless command. However, the drive is consideredbootable as an EFI-compliant boot volume (it has *.efi files in specificplaces), and this is the boot method we’re using here. SIP aside, thebless utility is a bit buggy, and we can use rEFInd without a blessedpartition just fine.