Triple Booting Your Mac
Friday, October 31st, 2008Updated March 2, 2010 Removed unnecessary steps involving Boot Camp and simplified the whole process.
As a software developer, I find it important to ensure that my programs work well on all platforms. Windows, Mac OS X, Linux, whatever. So I decided I should triple-boot my MacBook Pro instead of juggling between a Mac/Windows or Mac/Linux setup.
I’m annoyed that every article I’ve found about setting up a Mac to triple-boot makes it sound like it’s impossible to have greater than four partitions (especially for triple-booting). This simply isn’t the case, and it is hazardous for Linux’s performance in particular because you’re forced to set up a swap file instead of a swap partition and in the case of Gentoo, the /usr/portage mountpoint can’t be separate from the main filesystem (/usr/portage changes frequently and quite randomly, generating awful fragmentation). I’ve had Gentoo installs which had 8 partitions just for Gentoo itself (split up the filesystem to better optimize the usage).
In the past, the problem has been that Intel Macs use the GUID Partition Table (GPT) scheme for representing partition information on disk. Since Windows even now only recognizes the Master Boot Record (MBR) format, Apple came up with a trick that basically makes the disk use a GPT/MBR hybrid. It stores two copies of the partition table. One in GPT format, and one in MBR format. Seems straightforward? It gets tricky.
With MBR, you are limited to 4 ‘primary’ partitions. Once MBR was designed and out the door, people began to realize that 4 partitions just wasn’t enough, and an extension to MBR was developed that would not break compatibility with the existing MBR definition. The extension allowed for one of the primary partitions to be marked as an ‘extended’ partition. Extended partitions sort of store their own partition table which keeps track of the ‘logical’ partitions contained in them.
With the GPT/MBR hybrid, Mac OS X’s Boot Camp software will synchronize the tables once (and once only, which is why we have ‘gptsync’, detailed below). Unfortunately, GPT doesn’t understand extended/logical partitions and gptsync refuses to sync when it detects the MBR has extended partitions defined. So the limitation here is that we cannot have any extended partitions in the MBR if we want GPT/MBR syncing to work.
The solution is pretty simple, really. Windows requires MBR partitioning, but the Linux kernel does not. Simply set up the partition tables with gparted (or with the Mac OS X ‘gpt’ command while booted into an install DVD), run the gptsync tool (which can be run pretty easily if you have rEFIt), install Windows, and finally install Linux. Windows will only see the MBR partitioning scheme, and if your running Linux kernel supports GPT, Linux will see the GPT scheme. Detailed steps are below:
- Boot a Mac OS X install DVD. Bring up Disk Utility and partition your drive. Use as much space as you want for Mac OS X, but be sure to leave unpartitioned space for other OSes.
- You can now add partitions for Linux and Windows using the ‘gpt’ command in terminal. A manual page for how to use it is here.
- I recommend having the partitioning scheme be:
- EFI partition (don’t touch this)
- Mac OS X partition
- Linux /boot partition (about 500MB is fine)
- Windows partition
and then whatever other partitions you want for Linux. At minimum, you need to have a partition for the Linux root, but you should probably go with one for swap, one for /home, and one for /.
- Once your partitions are set, install Mac OS X to your Mac partition.
- Install rEFIt. Be sure to enable it, too, by running ‘sudo /efi/refit/enable-always.sh’ in a terminal.
- Reboot, and run the gptsync tool from the rEFIt menu (it’s the disk icon on the lower left). Make sure the changes it recommends are sane, and then type ‘y’.
- Your partitions are now ready for your operating systems. Install Linux (Ubuntu, Fedora, whatever), and be sure to specify that the bootloader gets installed to the /boot partition (not to the master boot record, where it would be wiped out by Windows).
- Once Linux is in, be sure to run ‘gptsync’ again, to be sure the partition table didn’t get clobbered.
- Install Windows to the 4th partition. This can be tricky because Windows won’t install if the partition isn’t marked ‘active’. Either use a Linux livecd and ‘cfdisk’ to mark it ‘Boot’ or use a Windows Vista or Windows 7 disc’s command prompt to mark the partition ‘active’ with ‘diskpart’.
- You should now have a Mac+Linux+Windows machine. Great for software development!
I kind of whipped this article up in a hurry. If there are any questions about this, email me.


