Installing rEFInd Manually Using Mac OS X

 

Before installing rEFInd on a Mac, you must determine whether it uses a 32-bit or 64-bit EFI implementation. Most Intel-based Macs have 64-bit EFIs, so you should use the refind_x64.efi file with them; but very early Intel-based Macs have 32-bit EFIs (and sometimes 32-bit CPUs), which require the refind_ia32.efi file. You can determine whether your Mac needs the x86-64 or IA32 build by typing the following command in a Mac Terminal window:

$ ioreg -l -p IODeviceTree | grep firmware-abi

The result should include either EFI32 or EFI64, indicating that you should use the refind_ia32.efi or refind_x64.efi binary, respectively.

You should also be aware of your OS X version and installation options. If you used whole-disk encryption (WDE) or a logical volume for installation, you cannot install to the OS X root partition; you must install to the ESP or to a separate HFS+ partition. WDE became an option with OS X 10.7 and logical volumes are the default in OS X 10.10. If in doubt, proceed with an installation to the ESP or to a separate HFS+ partition.

The procedure for installing rEFInd on a Mac is similar to that for installing it under Linux, except that you must use the bless utility rather than efibootmgr to register the program with the firmware. Also, you’ll probably have to mount your ESP manually, since that’s not done by default under OS X. To be precise, you should follow these steps:

  1. Open a Terminal window in which you’ll type the following commands.
  2. If you want to install rEFInd on your ESP, you must first mount it. The easy way to do this is to use the mountesp script that comes with rEFInd. When you run it, the script should tell you where the ESP was mounted. You can do the job manually by typing mkdir /Volumes/ESP followed by sudo mount -t msdos /dev/disk0s1 /Volumes/ESP. Note that you may need to change /dev/disk0s1 to something else if your ESP is at an unusual location. Type diskutil list or use a tool such as my GPT fdisk (gdisk) to examine your partition table to find your ESP if necessary.
  3. Type sudo mkdir -p /Volumes/ESP/efi/refind to create a suitable directory for rEFInd. If you want to place rEFInd on the OS X root partition, you should adjust the pathname appropriately, as in /efi/refind. Alternatively, you can use the Finder to create the directory.
  4. Copy the files in the refind subdirectory of the rEFInd binary package to the like-named directory you’ve just created. You can do this in the Finder or by typing sudo cp -r refind/* /Volumes/ESP/efi/refind/ in your Terminal window after changing into the rEFInd package’s main directory.
  5. Remove the files for the versions of rEFInd you’re not using, as in sudo rm Volumes/esp/efi/refind/refind_ia32.efi Volumes/esp/efi/refind/refind_aa64.efi on a Mac with a 64-bit EFI or sudo rm /Volumes/ESP/efi/refind/refind_x64.efi Volumes/esp/efi/refind/refind_aa64.efi on a Mac with a 32-bit EFI.
  6. Optionally, remove the drivers directories for the architectures you’re not using—/Volumes/ESP/efi/refind/drivers_ia32 or /Volumes/ESP/efi/refind/drivers_x64, as appropriate. (No Mac uses an ARM CPU, so you’d also remove /Volumes/ESP/efi/refind/drivers_aa64 You may also want to remove some or all of the drivers for the architecture you are using; if you don’t need them, they’ll slow down the start process. See the page on drivers for more on this topic. Note that Apple’s firmware includes its own HFS+ driver, so the HFS+ driver provided with rEFInd is useless on Macs.
  7. If this is your first installation, type sudo mv /Volumes/ESP/efi/refind/refind.conf-sample /Volumes/ESP/efi/refind/refind.conf (adjusting the path as necessary) to rename the sample configuration file so that it will serve as a real configuration file. (Again, you can do this with the Finder, if you prefer.)
  8. “Bless” rEFInd by typing one of the following two commands:
    • If you’re installing rEFInd on the ESP, type sudo bless --mount /Volumes/ESP --setBoot --file /Volumes/ESP/efi/refind/refind_x64.efi --shortform, adjusting the mount point and exact path to the file as appropriate for your installation.
    • If you’re installing rEFInd to an ordinary HFS+ volume, type sudo bless --setBoot --folder /efi/refind --file /efi/refind/refind_x64.efi. (Adjust the path and filename as necessary if you’re placing rEFInd somewhere else or using the 32-bit version.)

    This is the step that’s likely to fail if your system is booted with SIP active.

  9. If you don’t want to reboot immediately after installing rEFInd, you may optionally unmount the ESP by typing sudo umount /dev/disk0s1 or sudo umount /Volumes/ESP. This step isn’t strictly required, but if you want to keep the ESP out of your directory tree, it can be useful.

When you reboot, your Mac should bring up the rEFInd menu, and should continue to do so thereafter. If you make changes that break this association, you can re-run the bless command (if necessary, restoring the rEFInd files first). This might be necessary after installing system updates from Apple or if you upgrade rEFInd to a newer version.

If you’re replacing rEFIt, you may discover that rEFInd works on the first boot, but the system reverts back to rEFIt or a direct boot to OS X on the second boot. To fix this problem, you can remove the rEFItBlesser program, which is located at /Library/StartupItems/rEFItBlesser. This program attempts to keep rEFIt set as the default boot loader, but it also has the purpose of protecting the computer from launching the wrong OS after waking from sleep. If you want that protection, my suggestion is to install rEFIt and rEFItBlesser and then replace the refit.efi file with refind_x64.efi or refind_ia32.efi (renaming it to refit.efi). Used in this way, rEFInd will still look for its own configuration file, refind.conf, so you’ll need to move it but not rename it. If you don’t move the icons from the rEFInd package, your icons will continue to look like rEFIt icons, and you’ll be missing the new icons for specific Linux distributions that rEFInd provides. One final caveat: It’s conceivable that rEFItBlesser is what’s causing filesystem corruption for some users, so if you’ve been having this problem with rEFIt, it might be worth disabling this program and not using it with rEFInd.

If you want to remove rEFInd from your system, you can delete its files. The Mac will revert to booting using whatever standard boot loader it can find. Alternatively, you can use bless to bless another EFI boot loader. The GUI Startup Disk utility in System Preferences provides a simplified interface that enables you to select which OS X installation to boot, but it doesn’t look for non-Apple boot loaders, so you can’t use it to enable rEFInd.