How to stop macOS updates from taking over the rEFInd boot manager? [duplicate]

I have rEFInd installed on the EFI partition of my 2015 MacBook Air. Every time I update macOS, it ends up taking over the bootloader and resetting it to using the macOS operating system. Afterwards, if I hold the option key while booting up my mac, there is no boot option for rEFInd that I can select. The only way I can bring rEFInd back is to boot up into recovery mode, manually mount my system partition with Disk Utility (as it is encrypted using FileVault), then open Terminal and reinstall rEFInd. It's quite a hassle.

Is there any better way to handle macOS updates?

I have read the section of the rEFInd manual named "Recovering from a Coup Using MacOS" but I didn't find any information in there that was pertinent to my situation. Note that I cannot disable System Integrity Protection (which one of the solutions there requires) as I need to keep it enabled for the software development I do on this system.

Below is the output from the command diskutil list disk0.

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         121.1 GB   disk0s2

I have Windows, Linux, and macOS 10.15 beta installed to an external drive, so my MacBook's internal drive just has macOS.


Solution 1:

By default, rEFInd is installed in the EFI partition. Another option is to install rEFInd in a new small "Mac OS Extended (Journaled)" volume. This will allow rEFInd to appear in the Startup Manager.

Below are the steps. The commands need to be entered into a Terminal application window.

  1. Create the new volume. The diskutil command, shrinks the APFS container (121100M, i.e. 121.1 GB) by 300 MB (120800M) and creates the new 300 MB "Mac OS Extended (Journaled)" volume labeled "Macintosh HD via rEFInd".

    sudo diskutil ap resizeContainer disk1 120800M JHFS+ "rEFInd" 0
    

    After the command completes, restart the Mac.

    Note: If you get an error message which includes the phrase "perhaps caused by APFS Snapshot usage by Time Machine", then see Neil's own answer to the question: Can't resize APFS Container: Not enough free space in Container due to APFS limits or tidemarks.

  2. Download the rEFInd Boot Manager software from this SourceForge web site. Enter the following commands to install the software to the "Macintosh HD via rEFInd" volume.

    cd ~/Downloads/refind-bin-0.11.4
    ./refind-install --ownhfs /dev/disk0s3
    

    Note: The error message Could not set boot device property: 0xe00002bc was expected and can be ignored.

  3. (Optional) Use the command below to navigate to the folder containing the refind.conf file.

    cd "/Volumes/rEFInd/System/Library/CoreServices"
    

    Add write permissions to the CoreServices folder and the refind.conf file.

    sudo  chmod  a+w  .  refind.conf
    
  4. Restart the Mac and immediately hold down the option key until the Startup Manager icons appears. Next, hold down the control key and select to boot from the rEFInd volume.