Sunday, 19 January 2014

Installing Ubuntu on a Retina Macbook Pro - the easy way

Update: If you have Mac OS X 10.10 (Yosemite) installed, then the rEFInd installation needs to be handled differently. Please check the rEFInd website for more details.

In my previous installation guide, I outlined the first way that I found of installing Ubuntu on a Retina Macbook Pro. One of the challenges of the installation was that the boot manager, rEFInd, needed the Linux kernel to be copied from the Linux partition to the Mac OS X partition. This then becomes a painful process that needs to be repeated every time there is a kernel update on Ubuntu. Fortunately, there is a better way! Thanks to a comment on the rEFInd website, I found out that file system drivers can be installed that allow rEFInd to read the Linux partition.

This post outlines the full installation instructions, but if you already followed the previous guide, you can update the rEFInd installation and configuration file. I've included some instructions on that in the post.

1. Partition the Hard Drive

This step is nice and easy on the Mac. Just launch Disk Utility, click on the laptop's hard drive and click on the Partition tab. From there the Mac OS X partition can be resized. Disk Utility allows you to create a new partition with the extra space, but I just left it as Free Space, so that it would be created by the Ubuntu installer.

2. Create the Ubuntu USB Installer

The latest stable release of Ubuntu is available at - you'll need the 64-bit Mac (AMD64) desktop image.

Instructions for creating a bootable USB stick are provided, you'll just need to remember to use the latest ISO that was downloaded above. Note: unlike some disk image files, Mac OS X cannot mount the disk image, but it will boot fine from it.

3. Install an EFI Boot Manager: rEFInd

Previously, I've used Refit as a boot manager and boot loader for Ubuntu on a Mac, but that doesn't seem to be maintained any more. So, for the Retina Macbook Pro I've switched to rEFInd, which is just a Boot Manager. We'll then be loading Ubuntu using EFI instead of Grub, which means we can leave the old world of BIOS behind. See the rEFInd website for more information about boot managers and loaders, EFI and Grub.

Download the binary rEFInd zip file from and unzip it by double-clicking the file in the Mac OS X Finder. You'll want to check out the rEFInd installation instructions, but I chose the simplest option of installing rEFInd in the Mac OS X partition. There are other possibilities, but this seemed the easiest for me to manage - especially if something went wrong.

The installation needs to be done in the Terminal, by running the script:
 cd ~/Downloads/refind-bin-0.7.7  
 ./ --alldrivers

The '--alldrivers' option installs the file system drivers for rEFInd, which allows the boot manager to be able to access the Ubuntu kernel files on the Linux file system. If you are upgrading from a previous installation of rEFInd, it will keep your existing rEFInd config file and copy the latest version with a different name.

The script will prompt for your password so it can run with administrator privileges using sudo. Once the script has run, rEFInd is installed and you can see the configuration files at /EFI/refind.

You'll need to reboot a couple of times before you can see the rEFInd menu appearing. We'll need to configure rEFInd later.

4. Installing Ubuntu

Connect your bootable USB drive into the Macbook Pro and reboot - you should see the USB stick as an option in the rEFInd boot menu, so boot from that. In the Ubuntu installer, select the Try Ubuntu option and it will take you to the Ubuntu desktop at a resolution of 2880x1800 - you may need a magnifying glass handy to read the text. That said, it does look beautiful!

By default, Ubuntu has 'touch to click' enabled for the trackpad by default, which I found difficult work with. So the first thing I did was to turn that off in the Mouse and Trackpad area of System Settings. Next, it's worth changing the screen resolution to something more usable - I selected 1680x1050 (16:10). After that, if you are using WiFi, then you'll need to connect to the network.

4.1 Install Ubuntu

You're now ready to install Ubuntu. We want to do this without installing the Grub boot-loader, which would put us back into the old-world BIOS mode. To install without Grub, run the following in a terminal:
 ubiquity -b  
This will launch the installer and you can follow the instructions to install Ubuntu on the free space that we created earlier, alongside Mac OS X.

Once you are done, you can reboot into Mac OS X. You'll notice that the Ubuntu partition is not showing up in rEFInd as yet - that's what we need to fix next.

5. Configure rEFInd

We need to configure rEFInd so that it sees that Ubuntu partition and has all the correct details so it can boot from it. The rEFInd configuration is in /EFI, which will need root access to be able to update the details. I found that TextWrangler is a great option for editing config file as it allows you to authenticate to update the files. Make sure that you download TextWrangler from the Barebones site as the version in the Apple App Store does not have this facility.

5.1 Configuration File Changes

It's worth checking the rEFInd site for more details about the configuration file changes, as there are a lot more options than I will cover. The main configuration file is /EFI/refind/refind.conf. If you've upgraded from a previous version of rEFInd, you may want to use the sample config file instead of the current version that you are using. We need to configure rEFInd so that it scans the hard disk for other boot options. The following file shows only the lines that I've changed from the default config file:

# Enable the scan for file system drivers
scan_driver_dirs EFI/tools/drivers,drivers

# Choose which drives to scan. This will only scan the internal hard drive.
scanfor internal

# Load the Linux file system driver
fs0: load ext4_x64.efi
fs0: map -r

These configuration file changes ensure that the Linux file system driver is loaded (ext4_x64.efi) and that the internal hard disk is scanned for bootable partitions. If there is more than one kernel found on the Linux file system, rEFInd will display all the available kernels.

That's it. If you want to make the boot screen a it prettier, you can copy a PNG or BMP image file to /EFI and add an extra line to the configuration file:
banner /EFI/MilkyWay.png 

6. Reboot Into Ubuntu

Once you reboot you should see the Ubuntu icon in the rEFInd boot menu, and it should start up. When  it does, you'll see Ubuntu in its 2880x1800 pixel glory. I've increased the default text size in Ubuntu and the browsers to roughly 1.5 times the normal size, and that has made a great work machine.


  1. I've found a ton of guides around the internet for installing Ubuntu on the latest retina MBPs, and your guide roughtly matches up with what I've found so far. However, one thing I haven't seen anywhere: On my 15" rMBP, I have to set the "nomodeset" option before booting or I end up with an almost-unreadable rainbow display and incorrect resolution. After setting nomodeset and booting into the live desktop, I have no other options for resolution nor can I adjust the brightness. I purposely did not get the dedicated Nvidia GPU along with the integrated Intel card so that I could avoid graphics issues. Is there something I'm missing?

    It may be worth noting that this is all specific to the live desktop; I haven't tried setting up rEFInd yet.

    1. This installation approach is different from if you are booting from a live desktop as that will be using grub. With the rEFInd setup described, you won't use grub at all. Take a look at the rEFInd docs for a better explanation than I can give:

  2. I have two questions

    The first is, is it possible to wakeup the Mac in Mac OS (I read that it will be broken, only sleep for a short time is possible). That is maybe a problem of the Hibernation mode in mac os.

    The second question is. You tutorial is only for a mac without crytped harddisk or?

    Thanks for your tutorial!

    1. Hibernation mode: that seems to be correct - Mac OS X doesn't do hibernation with refind installed. I don't know if there is a way around this.

      Encrypted hard disk: my Mac OS X partition is not encrypted - I'm not sure of the implications if it is. I do use an encrypted home folder on Ubuntu, but haven't tried full drive encryption.

  3. Hi, i have a problem when ubuntu came back from standby, unity ask me the password but then i got black screen, thus i installed the nvidia driver recommended by ubuntu 12.04LTS and now ubuntu doesn't boot. Do you have some suggest?

    1. You should be able to get to the text console by typing Ctrl-Alt-F1 (you may need to hold down the Fn key to get to F1). If you login there, you can uninstall the nvidia driver.

  4. Thanks for the guide. May I ask which rMPB model and which Ubuntu version you are on? I'm going for rMPB10.1 and Ubuntu 13.10, and hope that is a working combination.

    1. I'm using 13.10 and a rMBP 10.1.

    2. Thanks. Worked well for me, and refind 0.7.8 managed to boot Ubuntu without any config changes. My only issue is that I do not seem to have the network drivers I need.

    3. Check the comments on my previous blog post as there are a couple of solutions mentioned there (

      Solution 1:
      sudo apt-get --reinstall install bcmwl-kernel-source

      Solution 2:
      So, when you're going through the first few pages of the ubuntu installer, the wifi will be broken, but select the install 3rd part apps and proceed. It will then ask you to connect to a network, and after a few seconds the wifi driver seems to kick into gear and fix itself. From here, connect to your network, go back a page, and select both external installation options. After it installs the wifi should work out of the box.

  5. Thanks. I already fixed it by downloading the needed packages to a usbdrive and installing them.

  6. According to step 5.1. which line should i change with new command?

  7. THANK YOU!!!!! Ive been trying for 4 hours now and this finally worked

  8. Here are some notes from my installation on a MacBookPro10,1 (same approach as you):

    I was not able to upgrade graphically smoothly from 13.10 to 14.04: the screen went blank at some stage (but the computer was up and running since I was able to connect to it through ssh, but found no way to get screen access back). Thus I was forced to reinstall from scratch.

    During installation I was able to activate wifi networking by choosing 3rd part devices drivers. Unfortunately after the first reboot the drivers are not loaded anymore. I thus was forced to connect via a wired USB-ethernet dongle just in order to install theses drivers again. That sounds a bug of ubiquity to me.

    I need the suspend to RAM feature to work. The xorg nouveau driver seems not to support it. I thus needed to deactivate the nvidia discrete card and let the integrated card manage the display alone. To do that I installed the gfxCardStatus (use and no more recent version) on MacOS X and choose the "Integrated Card Only" state. After that the `/sys/kernel/debug/vgaswitcheroo/switch` file may be used to switch the nvidia card completely off.

    I used full encrypted partition for swap and `/srv` (where all my data are really stored), I choose to reuse them after the first boot by re-creating the `/etc/crypttab` file and modifying the `/etc/fstab`.

    1. The graphical upgrade from 13.10 to 14.04 worked fine for me - I just have home directory encryption, not full disk encryption (if that makes a difference).

      I'm using the nouveau driver and that works fine on the retina screen (especially with the new "Scale menus and title bars" option in the display settings in 14.04). However, I've found that connecting to an external display no longer works for me - I get a black screen.

      I'd like to try the Intel driver, as you have done. I tried that on 13.04 and found that I just had a black screen. Thanks for the tip.

  9. Hello there! This seems to be a great guide compared to the more official one: :)

    A couple of questions, I have a Macbook pro 11.1 with 13 inch screen WITHOUT any Nvidia chipset, instead there is an Intel GPU on it, will this guide work for that? Another, how good touchpad functions does Ubuntu has compared to OSX? The touchpad is lovely on this laptop compared to the Windows laptop I used before :)

    1. It should work for the Intel GPU. I've only managed to get hybrid graphics working with the Nvidia GPU.

      The touchpad is a little sensitive for my liking, but works okay.

  10. Hello,

    I had a problem if anyone could assist me with please.
    In the 5.1 section of the instructions (editing the rEFI.conf); I managed to edit the first two piece of lines shown above however I am unsure where to place the code
    "fs0: load ext4_x64.efi" &
    "fs0: map -r"

    also the banner piece of code for the boot screen doesn't seem to take effect. At the moment I have placed it right at the bottom of the conf file.

    Could anyone please help me with the 5.1 section especially.
    Thanks in advance.

  11. A couple of questions:
    1. How's the battery life compared to Yosemite?
    2. Do you have a list of the working and non-working hardware?

    PS. Awesome guide BTW