It's a wonderful world!

Installing Ubuntu on a Macbook Pro (Retina 13″)

Or two ways to install Ubuntu 13.04 on a ‘MacBook Pro, 13″ with Retina
display’ (also known as MacBookPro10,2)…

Having recently joined Canonical, my first task was to provision a
laptop to work on, naturally running Ubuntu. Asking for advice about
which models to choose, I was advised to seek out designs with Intel
wifi & graphics adaptors, presumably down to the quality of the open
source drivers available. The 13″ retina MacBook has a screen I wanted
to use, and met half the criteria – it uses Intel graphics. I was also
encouraged to believe that installing on a modern Mac had gotten a lot
easier than the information readily available suggests, so I gambled
on the wifi requirement. It seems to have paid off.

The major decision is how to host OS X. You need to maintain a copy to
host the firmware updates occasionally issued by Apple – they make no
pretense to support anything other than OS X as a host for these.

You can elect to have OS X on an external drive, or keep an internal
partition with it on. The first implies that when the external drive is
not connected, the PC will be ‘single booting’ to Ubuntu, and the
internal storage can be entirely managed by Ubuntu. The second option
implies a ‘dual boot’ setup, and dividing the internal storage between
the two operating systems. Having chosen a single boot or dual boot configuration, a
secondary decision is how to select between this OS X instance and
Ubuntu at boot time. The Mac’s boot manager ‘Startup Manager‘ can
easily cope with multiple boot options, but it does prefer to manage
instances of OS X. I only enjoy using it when it can be used as with
OS X, booting straight to some preferred default unless keys are held
down. rEFInd is an excellent alternative boot manager, and I’ve used
it in the dual boot configuration.

Elect to ‘continue’ after selecting your language. You’ll have been informed you’re currently offline by a notification window.

Elect to ‘Install this third party software’ and continue. This is where your wifi driver is coming from.

Elect to set up the ‘Broadcom Corporation BCM4331 802.11a/b/g/n’, selecting ‘connect to this network’, and configuring your wifi details. ‘Connect’ attempts to connect, and you use the same button a second time (as ‘continue’) to proceed if the connection works.

Once you’ve first logged in, allow Ubuntu to pull down the updates since the CD image you used was mastered.

After it reboots, and you log in, you may find your audio is mute. In which case, you’ve been bitten by bug 1169984, and you need to follow the workaround listed. When I wrote these notes the fix hadn’t made it to the auto-update set.

You will find the built in microphone doesn’t work. To enable this, the snd_hda_intel module needs to be explicitly informed which model it is running on, so add:options snd-hda-intel model=mbp101
to the file /etc/modprobe.d/alsa-base.conf (sudo nano /etc/modprobe.d/alsa-base.conf is a good choice, if you’re used to mac editors), and reboot one last time.

The basic steps

Boot OS X and get the latest updates. Adjust the volume if you want to mute the boot chime

Restart, and ask the Mac to boot its recovery partition. (Hold down ‘option/alt’ while it boots)

Install a copy of OS X on your external drive

Install Ubuntu, replacing the internal OS X, using the 3rd party software offered (that’s where the wifi drivers are)

Fix up the Ubuntu EFI install, so the Mac Startup Manager can understand it

Fix a couple of audio bugs

Whenever you want to boot to OS X you need to insert your usb key, and use ‘option/alt’ during boot to select it.

More detailed steps

Boot the Macintosh, and walk through the OS X setup

Now’s a good time to adjust the volume. If you mute now, the boot
chime will also be muted – Ubuntu lacks a tool to control the boot chime.

Allow OS X to update (via the App Store). This may take a few cycles, if several updates need applying in sequence, and it will catch any firmware updates already issued.

Restart, holding down ‘option/alt’ (the label depends on your keyboard) as the boot starts, to get the Apple Startup Manager. Select the Recovery partition, and boot that.

Insert your external drive, and if needed, use Disk Utility to arrange for it to have a single ‘Mac OS Extended (Journaled)’ partition with the device using a ‘GUID Partition Table’ (This part is in Options). Note that the utility will allow space for a recovery partition also. Quit to return to the recovery menu.

‘Reinstall OS X’, selecting your external drive as the target. The setup wizard can be configured as you wish, and it appears that an Apple ID is optional to set up the OS, and receive firmware and OS updates.

Boot this version of the OS, and take the chance to make sure it is up to date. Shut it down, and remove the external drive.

Insert your Ubuntu USB key (use a 64-bit, not 64-bit Mac image, see notes below), and boot to the Startup Manager using ‘option/alt’. Select one of the ‘EFI Boot’ options (both seem to work equally well).

Select ‘Install Ubuntu’

Elect to ‘continue’ after selecting your language. You’ll have been informed you’re currently offline by a notification window.

Elect to ‘Install this third party software’ and continue. This is where your wifi driver is coming from.

Elect to set up the ‘Broadcom Corporation BCM4331 802.11a/b/g/n’, selecting ‘connect to this network’, and configuring your wifi details. ‘Connect’ attempts to connect, and you use the same button a second time (as ‘continue’) to proceed if the connection works.

Elect to ‘Replace Mac OS X with Ubuntu’. Given that we’re effectively taking over the machine, the wizard knows how to offer full disk encryption and LVM support. Use them if you wish, and enter the necessary encryption key if you do.

Check the final dialog is proposing to install on the internal disk, and then start the install proper.

The Startup Manager thinks a bit, and then gives up, prompting you with a Folder icon with a question mark. Insert the Ubuntu USB key, and after booting it, elect to ‘Try Ubuntu without installing’. We’ll use Ubuntu to patch things up with Startup Manager.

Bring up a terminal, mount your EFI partition (a relatively small FAT32 partition), and rename the bootloader ubuntu installed to have the default EFI name:$ sudo mkdir /boot/efi
$ sudo mount /dev/sda1 /boot/efi
$ sudo mv /boot/efi/EFI/ubuntu /boot/efi/EFI/BOOT
$ sudo mv /boot/efi/EFI/BOOT/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
You can now shutdown Ubuntu and remove the USB key. There may be other more sophisticated ways to patch up what Ubuntu and Startup Manager can agree via the dialect of EFI they have in common, but setting the bootloader name to the default works for now.

Boot the machine, and it will take you straight to Ubuntu.

Once you’ve first logged in, allow Ubuntu to pull down the updates since the CD image you used was mastered.

After it reboots, and you log in, you may find your audio is mute. In which case, you’ve been bitten by bug 1169984, and you need to follow the workaround listed. When I wrote these notes the fix hadn’t made it to the auto-update set.

You will find the built in microphone doesn’t work. To enable this, the snd_hda_intel module needs to be explicitly informed which model it is running on, so add:options snd-hda-intel model=mbp101
to the file /etc/modprobe.d/alsa-base.conf (sudo nano /etc/modprobe.d/alsa-base.conf is a good choice, if you’re used to mac editors), and reboot one last time.

You’re done!

Notes

If you’ve got one, the Thunderbolt ethernet adaptor works, and removes the need to install 3rd party software at install time to get on the internet. I assume you could then choose exactly which third party software you install post-setup, and get the wifi that way.

As far as what works, the screen is gorgeous, but I think it’s worth tweaking font sizes and so on to trade readability & screen real estate (Unity Tweak Tool is your friend). I like that Ubuntu gives me more choices here than OS X. The ‘function’ keys above the keyboard work similarly to OS X, with all but the launchpad (!) and mission control buttons mapping to Ubuntu functions. The keyboard & screen backlights work, as do the audio controls. The trackpad can be configured to support two finger scrolling in the same fashion as OS X, if you’re like me and already habituated to that.

It appears that an Apple ID is optional during setup of your OS X image, and the App Store still provides OS and firmware updates to machines without a logged in ID.

FWIW, I can see no reason you couldn’t configure a dual boot system to encrypt the Ubuntu installation, but the wizard can’t help you, and I’ve not explored the options (my machine single boots).

If you’re willing to live without OS X entirely you have two recovery options if you want to uninstall Ubuntu and return to OS X. You can create a standalone recovery USB key (needs less space than an OS X bootable disk), or you can depend on the internet recovery mode available in the Apple Startup Manager.

Ubuntu 13.04 is available in at least 3 desktop flavors: 32bit, 64bit, and ’64bit Mac’. Whilst the 32bit one clearly can work (I tried it, the OS did boot), you end up using a BIOS compatibility shim that Apple seem to have only intended for use with Windows. Having used the plain 64 bit install a lot while writing this, I did briefly try the mac flavour. My notes are poor, but I recall it didn’t work well on this modern Mac. Given the current support in the standard 64 bit installer, there seems to be no need to use it. Fortunately the default download page contains apparently good advice to select the standard 64 bit verson for a modern PC.

The built in microphone not working had me puzzled for a while, and I used a USB headset until I found the workaround. I was looking for information on hotplugging thunderbolt (which seems not to work yet), and found an installation guide for Fedora 18 that noted the crucial step of letting snd_hda_intel know it is running on an mpb101. With this step the built in audio is fully functional.

21 thoughts on “Installing Ubuntu on a Macbook Pro (Retina 13″)”

I’ve recently joined a dev team where I was given the option of a Mac or Thinkpad, and I chose Mac as I could have Ubuntu/Mint and OSX for Photoshop. I hadn’t factored in that Mint certainly wasn’t capable of handling a retina screen (15″) and Ubuntu appears very very small.

Is the Unity Tweak Tool enough to modify display settings such that text, icons and panels are all crisp AND readable? Are there any areas which don’t scale well, even with the unity tool? (In applications I mean). Thanks, will give it a try later on today but would appreciate any pointers/configurations that have you feeling satisfied!

Yes, I use unity tweak tool and all the dev tools I use frequently (mostly emacs and terminals) work well at whatever you tweak the font size to be. Stuff I’ve installed like QT creator and the Android studio appear to ‘just do the right thing’.

The exception is firefox, which works better for me if I use the ‘no squint’ firefox plugin to adjust the default rendering size.

One other gotcha is that when you plug in an external monitor, it will inevitably be a lower dpi, so I found I tuned unity tweak tool to a happy medium for terminals, etc as they moved between screens, and and I flip firefox windows nosquint settings by hand as I move them between monitors.

This will presumably get fixed when external monitor support at a different DPI is added to Unity (or wherever in the stack that belongs!)

For me, this has been a small price to pay for huge, high res terminals, websites and emacs windows :-)

I still like it! As noted above, the change in pixel density on an external monitor is not ideal, but that aside, it’s all good. The screen is still great. Thunderbolt hotplugging still doesn’t appear to work, but the display subsystem (perhaps technically displayport?) hotplugs well.

Hi John, thanks for your great guide. I find it especially useful because I want to use Ubuntu in single boot mode.
However, my Macbook Pro 10,1 does not resume from suspend-mode. Instead, it seems to work for a few seconds after re-opening the lid and then freezes. Did you come across this problem while using ubuntu?

Seeing your comment, I realised I had never actually used that slot on my machine :-) So I stuck in an SD Card I found, and it appears to work fine. Right now, the machine has recently been distro-upgraded to 13.10, so I think SD on 13.10 ‘works for me’. I’m not aware of having done anything to achieve that :-/

Refind is installed and it sees my ubuntu usb stick fine, but when I try to boot it to start the installer i get to the “grub” screen where I select Install Ubuntu option. After that the screen goes blank and after a while i end up to command prompt, or initramfs mode.

My Ubuntu install works pretty well, but only problem I have is when I leave my MBP to idle for a long time. Last night when I went to bed i left my laptop to sync some android sources and when I woked up this morning and tried to start using the laptop again, i couldn’t get it to wake up. The screen “turned on” but it stayd blank, no mouse cursor or anything.

Any ideas what could I do to fix this. I installed 13.10 using the normal desktop ISO file (not the mac version).

I’d like to recover my system back to OSX, but the OSX recovery and disk partitioning tool won’t allow me to delete or re-partition the linux partitions. Do I need to boot up with a linux usb stick and delete all of the partitions there?

That wasn’t my experience when I was experimenting with installing Ubuntu as I wrote this post (now some time ago). I took my machine back to virgin-osx state several times, using the recovery tools to repartition. Perhaps someone else can comment on how to get this working for you?

I have the same problem with OSX Mavericks, but I hit corruption when deleting the new partition – that is, when trying to add the space used by it back into my “main” partition.

I re-ran the “verify disk” while booted from the recovery mode, and it reported no errors, but now I have a partition labeled “free space” that I can’t use nor delete – I can’t even change the type or name of it :-(

I wasn’t sure i’d make it. ;z) i’m the guy who knows all the guys who’s friends make robots and do inteligence gov work.. and I just worked with DBM .. and can’t code unless that means understanding what the color of her eye shadow menas about her mood. ; -)
j/j but my friends all maner of real coders, (who figured out why my efi installs were not loading properly) or at all past OS x and rEifit… (rEifind.. wouldn’t install over it.. *yeah i know k-/
Now that I am duel booting into my brand new mackbook pro like 2 weeks old… it’s cool but it’s not that I can’t hear anything on it. ~~~
What is the ‘few sound fixes’ you eloud to here??ks,
Thanks
and I loved how you started out.. because target audence is everything right? ;z)

I haven’t looked into that – I rarely use suspend. I did look into the time it takes to boot – apparently the Mac firmware is ‘more thorough’ in its boot checks when it knows it is not running OSX. There’s a tool I found via google to adjust that, but I never used it. Depending on how suspend is working, that may be helpful. It would probably have been a grub/efi related tool.