Booting Macs

I’ve tried to install Linux on maybe 4 or 5 Mac machines. It was very tiring and difficult to get the machines to boot. One problem that came back each time was that I did not spend enough energy trying to understand the boot process.

This is a tutorial to remind myself of the stuff I did understand, and collect links to useful information.

Naming of parts

Boot manager
See rEFInd page for background. A boot manager is a program that allows you to choose which of several programs to start when you boot the machine. Distinguish this from the boot loader.
Boot loader
This is the software that, after booting, loads a program into memory that can start an operating system. GRUB is one example of software that provides both a boot manager and a boot loader.
The extensible firmware interface. First released as a specification by Intel, then revised by a group of vendors and released as UEFI. EFI often in fact refers to UEFI. See Intel EFI / UEFI. EFI and UEFI replace the old BIOS firmware standard. EFI specs have versions beginning 1.x - for example, the last Intel-only EFI spec was 1.10 (2005).
Unified extensible firmware interface - see UEFI. Designed and released by the Unified EFI forum. UEFI specs have release numbers of form 2.x. Release 2.1 was in January 2007, release 2.4 was in July 2013. Apple has a representative on the unified EFI forum.

As for the rEFInd pages, I’ll use EFI to refer to both of EFI and UEFI unless there’s some reason to distinguish the two, in which case I’ll make that clear.


The EFI / UEFI system replaces the BIOS firmware standard. Software that expects access the BIOS system calls will get upset and stop working when trying to run on top of EFI and vice-versa. This comes up for us Mac owners because older operating systems such as Windows XP need a BIOS to work against, and therefore there are some hoops to jump through getting XP to boot on an EFI system like the Mac.

Like the BIOS system, the EFI system provides:

  • Boot services: services that operate only when the system is booting
  • Runtime services: services that the OS can use to query hardware and so on while the OS is running.

EFI and GUID partition table disks

The EFI specifications include the specifications for the GUID Partition table format. The GPT format is a way of laying out the partition table on a disk. It is an alternative to the older Master Boot Record partition table format. Most EFI boot systems only read GPT partition tables, but some also read MBR tables. Some BIOS booting systems use GPT tables because of their technical advantages.

The standard EFI / UEFI boot

  1. There is a boot manager in firmware (not on disk)
    • firmware must also be able to read partition tables and FAT file systems.
  2. The firmware boot manager reads an EFI system partition - a partition on disk with a particular partition ID code. It uses the FAT file system.
  3. The boot manager can load EFI executable programs from the EFI system partition. EFI executable programs are programs that can run with no operating system support, using only EFI firmware service calls. These programs are frequently boot loaders (see above) but can also be other useful programs like diagnostic utilities.
  4. The choice of possible EFI executable programs can be explicit or implicit, controlled by a defined variable BootOrder stored in Non-volatile RAM (NVRAM):
    • If the BootOrder variable is defined, the boot options are explicit. The BootOrder variable contains a list of further EFI NVRAM variables, each defining the EFI executable program to run and any parameters to pass to that program. Each EFI variable pointed to by BootOrder corresponds to a choice the user should see when the boot manager starts. The boot manager then runs the chosen program with the given options.
    • If BootOrder is not defined, then the boot options are implicit, in that the boot manager should search all the disks on the system for a runnable EFI executable. The boot manager searches EFI system partitions on fixed disks, and assumes there is only one partition for removable disks. In either case, the boot manager looks for files with names of form: \EFI\BOOT\BOOT{machine type short-name}.EFI, where {machine type short-name} matches the CPU architecture. The short name can be one of IA32 (32-bit Intel), X64 (64-bit), IA64 (Itanium) ARM, AA64 (ARM 32 and 64 bit). For example \EFI\BOOT\BOOTX64.EFI matches the 64 bit standard Intel architecture.

EFI on Mac

The boot process on the Mac is highly non-standard for EFI (see efi-boot-process and rEFIt myths and facts).

Specializations in Apple EFI

Apple does not boot straight into a standard EFI boot sequence, but instead loads its own non-standard boot manager.

The Apple EPI firmware understands HFS+ (the standard Apple disk format) as well as the standard required FAT file format.

Apple can also enable BIOS-compatibility mode when booting. BIOS compatibility mode makes BIOS system calls available to the booting operating system to emulate booting in a standard BIOS firmware setup. The BIOS emulation comes from a compatibility support module (CSM) - see EFI and Ubuntu and Intel CSM docs.

I can’t see the conditions that enable BIOS emulation from the docs in front of me. The bless manpage online lists a flag --legacy that appears to activate BIOS emulation in subsequent boot. Quoting from EFI and Ubuntu:

As far as I can tell, BIOS emulation mode only works when a hybrid MBR is present on the hard disk or when a BIOS-bootable optical disk is inserted in the optical drive.

See hybrid MBR for more detail. In brief, there is a hack to a GUID partition table that can make the GPT also appear to be an MBR. The Apple “Bootcamp” utilities make this hybrid-MBR when making a partition to install Windows XP, but you can also do this with Rod Smith’s GPT fdisk (gdisk)

The boot process

  1. On boot, an Apple boot manager starts.

  2. The Apple boot manager uses the results of previous bless commands to select how to boot. The bless commands may have pointed to:

    • A file containing an .efi file to execute
    • A folder containing a file boot.efi file to execute
    • A partition from which to boot (in the efi-boot-device NVRAM variable)

    bless sets necessary NVRAM variables. In certain modes, bless also writes the location of the boot efi file into the HFS+ volume header, so that the location of the boot file persists if the disk is moved to another machine or the NVRAM gets cleared (see man bless or the bless manpage online).

  3. Somehow the BIOS compatibility mode can get activated. See above.

The EFI system partition on Mac

The Mac does indeed have an EFI partition, but it doesn’t use it for booting. On my laptop:

\$ diskutil list

#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *121.3 GB   disk0
1:                        EFI EFI                     209.7 MB   disk0s1
2:                  Apple_HFS Macintosh HD            120.5 GB   disk0s2
3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

We can mount the EFI partition, but it hasn’t got any defined BOOTable EFI programs. (Please be careful, you can mess up your system by writing into the EFI partition):

\$ diskutil mount /dev/disk0s1

Volume EFI on /dev/disk0s1 mounted

\$ ls /Volumes/EFI/EFI/


Unmount the file system to avoid accidental damage:

\$ diskutil unmount /Volumes/EFI

Volume EFI on disk0s1 unmounted