Dual Booting Linux and OS X on a MacBook Air

February 3, 2013

Screen of a MacBook Air booting Ubuntu Linux and Mac OS X Mountain Lion


There are tons of different approaches to this, all leading to the same end state. Here, I will overview a few of the possibilities, and discuss, in particular, what I did to enable this.

The options seem to be:

  1. Boot Linux from grub-pc, using rEFIt or rEFInd or similar boot shims
  2. Boot Linux from grub-efi, directly from the Apple firmware
  3. Boot Linux (>=3.3) directly from EFI as an EFISTUB

All of these can be accomplished without disrupting your Mac OS X install, if you’re careful. That’s almost a different topic, I guess. But if you’re doing this for the first time, you’ll probably end up re-installing Mac OSX. So just expect that.

Option 1 (rEFIt) is the easiest, and is widely documented. Novice or intermediate Linux users (anyone not at home on the command line) might prefer this route. Ubuntu has documented the install method at the UEFI page.

Option 2 is what I chose, because it’s cooler, and removes one step from the computer’s boot sequence. Also, it is an appealing option if you don’t like the look of rEFIt, find it kludgy, or have some other complaint about it.

Option 3 is the 1337est, by far, but the least documented on the Internet. Some of the only solid documentation I have found so far on the topic includes:

  1. Arch Linux UEFI Bootloaders
  2. Linux Documentation – EFI Boot Stub

I will probably try this later, and document the method in a separate post.

Anyway, we’re talking about Option 2, in this post. So back to that.

My Configuration

Alright, let’s describe the inputs and outputs of this process.

Input: An Apple MacBook Air 5,2 (mid-2012) running Mac OS X Mountain Lion

Output: The same system, dual booting Mac OS X Mountain Lion and Ubuntu 12.10 amd64 (NOT +mac) from grub-efi, loaded from the Apple bootloader.

Recommended Equipment

  1. Another computer that you won’t modify, connected to the Internet, preferably running Linux.
  2. One USB stick (two preferred)
  3. A Ubuntu 12.10 amd64 (NOT +mac) iso
  4. A Mountain Lion 10.8 Installer dmg

There are a couple ways to obtain the Macintosh installer dmg:

  1. (Recommended) legally, from the App Store, as described here.
  2. Shadily, from this torrent.

NOTE: I do not recommend option 2, as it is almost definitely illegal, and against Apple terms of service.

Preparing a Mountain Lion USB install disk

You should prepare one of your USB sticks as a bootable Mountain Lion install drive. Nate’s documented method works perfectly: How to create a bootable OS X Mountain Lion (10.8) USB drive from/with Linux.

One small note: when I went through it, the .img file I obtained was about four times larger than when he did it, and so had a different MD5 sum. But it still worked absolutely great. I think perhaps his .img was only one of the partitions?

Preparing a Ubuntu 12.10 USB install disk

You should also prepare another USB stick with the 12.10 amd64 image.

The usb-creator-gtk that comes with Ubuntu works great for this. From your reference Linux computer, download the 12.10 desktop iso, and follow the Ubuntu instructions on preparing USB install media with usb-creator-gtk.

Phase 1: Dual Boot with rEFIt

You’ll briefly install eEFIt to make your life simpler. You’ll remove it later.

If you don’t have Mac OS X Mountain Lion installed at all (at this point), then install it, using the USB drive mentioned above. Try to use about ~50% of the disk, and leave space for Ubuntu. Keep it as “free” sapce. Okay. So now you have Mac OS X.

Alternately, if you already had Mountain Lion installed, then use the Disk Utility to resize the main partition. Create some empty space, where we will (eventaully) install Linux.

Note: you can also accomplish this stuff with gdisk on Linux.

Once you have that all squared away, install rEFIt. See their webpage for up-to-date instructions on How-to install rEFIt. Easy.

At this point, you have a Mac OSX system with rEFIt installed.

So, plug in your Ubuntu install drive, reboot, and start a normal install. As you’re going through it, don’t modify any of the Apple partitions in any way.

Once the install completes, you have a dual boot system using rEFIt. Cool.

Stage 2: Getting rid of rEFIt

Basically, follow this existing guide to a T. Just replace literally all occurrences of “Debian” or “debian” with “Ubuntu” and “ubuntu”. Also be careful about partition indexes.

Debian EFI mode boot on a Macbook Pro, without rEFIt

Another note I will stress: you’re still not modifying the Apple partitions. The second EFI partition you create (there, sda5) is separate from, and in addition to, the Apple partition.

After you do that, you have to actually uninstall rEFIt, which is easy. Boot up OSX, and run:

sudo rm -r /efi

Note: that particular efi directory, at the root of the Mountain Lion install, is just rEFIt stuff; nothing else.

Stage 3: Bonus Points

So, you should be pretty much done, now.

I had to do a bit of cleanup though:

  1. Remove Mac OSX entries from /boot/grub/grub.cfg
  2. Change grub timeout to 0 seconds
  3. Add icons to the Ubuntu EFI partition, and Mountain Lion root.

The first two are pretty routine tasks for a Linux dude.

To get your icons in order, do as glandium.org suggests for the Linux install:

png2icns /boot/efi/.VolumeIcon.icns /path/to/some/128x128/png/file.png

For the Mountain Lion install, boot into Mac OSX.

Put the .VolumeIcon.icns at the root of your OSX install. For me it was /Volumes/Mountain\ Lion/, I think.

Then run this from Mac OS X, to enable a custom icon for the volume:

SetFile -a C /Volumes/Mountain\ Lion/  # Or whereever the volume is actually mounted.


There you have it — how I got to the boot screen pictured at top.

Join me next time for a blog on “Booting Linux as a UEFI Boot Stub on an Apple Macintosh.”

6 responses to “Dual Booting Linux and OS X on a MacBook Air”

  1. gentmatt says:

    Please, please try the Ubuntu installation using EFISTUB! I’ve bookmarked this page and will watch your blog for updates.

    Installing Ubuntu on macs has been a pain for me so far. I usually get it working, but the partition table is somehow always broken. When verifying the disk, Disk Utility reports various error messages – or the Recovery HD is missing (or can’t be found) which OSX needs for Filevault and iCloud related features.

    What I don’t get in this blog post is this: Why do you install rEFIt but then don’t sync the partition tables? You install rEFIt only to install Ubuntu. Then you remove it. You can boot from the install USB by holding ALT upon boot, just like you would do after the installation.

  2. […] and kind of get rid of the rEFIt to replace the new OS. If you are getting confused check here (http://nosemaj.org/dual-boot-mac-linux) because this is a supper delicate step. Do not mess up your machine read the content of the above […]

  3. […] mostly a reminder for me to not forget the extra steps for working around my GPU problem. There is this guide nosemaj.org and this on glandium.org and they explain very well the steps to enable EFI […]

  4. Tyler says:

    I have a Yosemite Hackintosh dual booting alongside Ubuntu via rEFInd. My main problem currently is Chameleon (my OS X bootloader) boot menu doesn’t identify Ubuntu. If I follow your tutorial to delete rEFInd now, is there any reason to believe Chameleon will be able to see it afterward? Do you expect I will run into any problems given that I am not running a legitimate Apple machine? Thanks!

Leave a Reply