Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Dual-booting Ubuntu 13 on a MacBook Pro

Dual-booting Ubuntu alongside OS X on your MacBook Pro


Why do this?

  1. To run a broader array of software than with OS X alone.
  2. To run faster, by more fully exploiting the hardware, and by running with a smaller memory footprint.
  3. To more fully customize the user interface.

Why not do this?

  1. Switching user interfaces frequently can undermine your muscle memory and be frustrating.
  2. Resume from sleeping state does not work correctly under Linux for me. Resume from sleep still works on OS X, but extended sleep (i.e. hibernation) may be broken. So Save before sleep!

Stage I - Preparation

  1. Make sure your data is backed up. One of the following steps is particularly dangerous, and you should keep a backup anyway. I use Apple's preinstalled Time Machine software, and I recommend it.

  2. Gather the following:

    • A USB stick with at least 4 GB of space. You can use this both for resizing your OS X partition in Stage II, and for installing Ubuntu in Stage IV.
    • Download Apple's Recovery Disk Assistant for use in Stage II. Copy the app onto your system, perhaps into Applications/Utilities.
    • Download and unzip the rEFInd bootloader. Save it anywhere you like under OS X for use in Stage III.
    • Download the latest Ubuntu 13 Desktop ISO. Save it anywhere you like under OS X for use in Stage IV.

Stage II - Resize your OS X partition

  1. Run the Recovery Disk Assistant, and use it to make your USB stick bootable to the OS X Recovery system. This is required because you can't resize partitions on the disk you booted from. It's pretty self-explanatory, and takes a minute or two. Creating Recovery USB

  2. With the USB stick inserted, reboot your Mac with the Option key held down. You'll see two options for booting to OS X Recovery - one represents the recovery partition on your laptop's internal drive, and one represents the recovery partition on the USB stick. boot options

See the USB icon on the right? Boot from that one! You should eventually be presented with the OS X Recovery Welcome Screen: Welcome Screen Choose your language, then run Disk Utility.

  1. Now unmount your Macintosh HD by selecting it from the device list on the left, and clicking the blue Unmount button. unmount os x volume

  2. Next, select the device itself from the left-hand list (one level above Macintosh HD), and click on the Partition button/tab to show its partition layout.

  3. Click on the large section that represents your main OS X partition, and reduce its size by typing in a new value. You should shrink it by at least 15 GB or so. I have a big fat SSD, so I gave it 50 GB. partition layout.

  4. Click the Apply button and wait for the resize to complete. Once it's done, reboot the computer back into OS X.

Stage III - Install rEFInd

  1. Open a Terminal, and change directories to the location where you unzipped rEFInd. Run its installer script, making sure to add the ext4 filesystem drivers that will allow auto-discovery of the Linux kernel.

     cd ~/Downloads/refind-bin-0.7.4
     ./ --alldrivers

    The script will prompt you for your password, beacuse it needs to act as root. It will install rEFInd into /EFI/refind.

  2. Reboot. You should be greeted with the rEFInd boot screen, which will boot you back into OS X by default. It should look like this, only with fewer icons (for now). rEFInd! Boot back up to OS X, to make sure all is well.

Stage IV - Install Ubuntu

  1. Open Terminal and run the following:

     diskutil list

    This will produce a list of storage devices attached to your Mac. You may have only your internal disk as /dev/disk0 (and its various partitions), but if you have other disks, you may see more devices. Make sure you understand which is which.

  2. Now insert the USB stick you'll use to install Ubuntu, and run disktuil list again. Take careful note of the new device name (/dev/disk1 or whatever) -- the one that represents the target USB stick.

  3. Change to the directory where you downloaded the Ubuntu ISO. Run the following command, but instead of [N], substitute the correct disk number for the USB from the previous step. (So if your USB stick is /dev/disk2, then substitute the number 2 for [N]):

     cd ~/Downloads
     sudo dd if=ubuntu-13.10-desktop-amd64+mac.iso of=/dev/rdisk[N] bs=1m

    (note that for this command, using /dev/rdisk makes the process go slightly faster than just /dev/disk)

    This command is silent while it runs, and may take some time if you're copying from a hard disk. Be patient. When it's done, OS X will try to mount the disk, unsuccessfully. You may see a dialog reading "The disk you inserted was not readable by this computer" -- this is normal. Go ahead and click Ignore or Eject, but don't actually pull out the USB stick.

  4. With the USB stick still inserted, reboot once again. rEFIt should discover the linux kernel on the Ubuntu USB stick, and present a corresponding boot option. Once it boots from the USB stick, go ahead and select Install Ubuntu.

  5. The rest of the process is quite strightforward - just make sure you tell the installer to create new partitions from the free space, and don't wipe out your existing partitions!

Stage V - Configuration Tips... maybe

This will have to wait for a separate blog post. But here's a list of things I got working with zero or minimal configuration:

  • Full-res display with OpenGL support, including external displays with a Thunderbolt adaptor. I'm told Retina displays work fine, but I don't have one.
  • Audio in and out, both analog and optical-digital;
  • Two-finger trackpad scrolling;
  • Cisco VPN connections through the built-in networking GUI;
  • Google Hangouts, Hipchat (native app), and AdobeConnect;
  • Readonly access to the OS X partition, for easy data migration;
  • Streaming (non-DRM) video to AppleTVs with the airplay ruby gem;
  • A Passenger/Nginx setup that will serve any Rack app located in ~/projects/[app_dir] from URLs like http://[app_dir].dev. This uses RBENV to select the correct Ruby, and eliminates both manual service startup, and manual port confuration for wiring the services together.

The following are not (yet) working for me:

  • Full range of trackpad gestures. I know how to fix this, but not in a way that won't break when Unity updates itself.
  • Streaming of system audio to AppleTV/AirPortExpress with PulseAudio's RAOP driver plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment