How to Install and Dual-Boot Ubuntu on Mac

Dual-booting macOS and Ubuntu requires a little adventurousness, but it’s not too difficult. There can be some problems with the bootloader, though, so we’ll need to deal with that. It’s not too hard to install (and dual-boot) Ubuntu on a Mac.

As a warning, it’s way more efficient to run Ubuntu on a virtual machine using VMWare. If for some reason this doesn’t work for you, dual booting should be your second option. Just a warning: some hardware functionality might never work right under Ubuntu. Macs can be weird under Linux, so only proceed if you possess the patience and technical know-how for troubleshooting.

Before you begin, back up your Mac. This is not optional.

1. Download Ubuntu

1. Download the current Ubuntu LTS installer from the Canonical website. As of publication, that version is Ubuntu 16.04.4 LTS.

dual-boot-ubuntu-on-mac-download-1

2. Donate to support Ubuntu, or click “Not Now” to go directly to the download page.

dual-boot-ubuntu-on-mac-download-2

2. Create Your Ubuntu Installation Drive

We will use a USB drive for this example. The drive must be at least 2 GB and empty.

Formatting the Drive

1. Insert your USB into your Mac.

2. Open Disk Utility from “Application/Utilities.” Select your USB drive in the sidebar.

dual-boot-ubuntu-on-mac-disk-utility-1

3. Click “Erase” in the menu bar to format the drive.

dual-boot-ubuntu-on-mac-disk-utility-2

4. In the next screen, set the format to “MS-DOS (FAT)” and the scheme to “GUID Partition Map.”

dual-boot-ubuntu-on-mac-disk-utility-3

5. Click “Erase” and wait for the formatting process to complete.

dual-boot-ubuntu-on-mac-disk-utility-4

If you have trouble with formatting, try doing the same thing with Terminal.

Writing the Image

We will use Etcher to write the Ubuntu install image to disk.

1. Download and install Etcher.

dual-boot-ubuntu-on-mac-etcher-1a

2. Open Etcher. Click “Select Image” and choose the Ubuntu ISO file.

dual-boot-ubuntu-on-mac-etcher-2

dual-boot-ubuntu-on-mac-etcher-3

4. Click “Select Drive” and choose your USB drive.

dual-boot-ubuntu-on-mac-etcher-5

dual-boot-ubuntu-on-mac-etcher-4

5. Click “Flash!” to write the image to your USB drive.

dual-boot-ubuntu-on-mac-etcher-6

dual-boot-ubuntu-on-mac-etcher-7

3. Prepping Your Drive

rEFInd will be our bootloader for both Ubuntu and macOS.

Installing rEFInd

1. Download rEFInd’s binary package.

2. Unzip the downloaded file.

3. Open Terminal from “/Applications/Utilities/Terminal.”

4. Drag the “refind-installer” file onto the Terminal icon to run the script.

dual-boot-ubuntu-on-mac-refind-05-copy

You may need to disable System Integrity Protection (SIP) before proceeding or install rEFInd from the recovery partition. To do so:

  • Reboot your Mac. When the startup screen shows up, press and hold the Command + R until the Apple logo appears on your screen.
  • Once it finishes loading and brings you to Recovery Mode, click “Utilities -> Terminal.”
  • In the Terminal window, type in csrutil disable and press Enter.
  • Restart your Mac.

dual-boot-ubuntu-on-mac-refind-02

5. Reboot your Mac to ensure rEFInd is operational.

dual-boot-ubuntu-on-mac-ubuntu-installer-01

Resizing the Boot Partition with Disk Utility

If we want to dual boot macOS and Ubuntu from the same hard drive, we’ll need to make a partition for Ubuntu with Disk Utility.

1. Open Disk Utility from the “/Applications/Utilities” folder.

2. Select your boot disk in the sidebar and click the “Partition” button.

dual-boot-ubuntu-on-mac-disk-utility-05

3. Click “Partition” in the dialog box to confirm.

dual-boot-ubuntu-on-mac-disk-utility-06

4. Click the “+” button to add a partition

dual-boot-ubuntu-on-mac-disk-utility-07

5. Set the size and name. Choose “MS-DOS (FAT)” for your partition type. This will be erased by the Ubuntu installer.

dual-boot-ubuntu-on-mac-disk-utility-08

6. Click “Apply,” then “Partition” to execute.

dual-boot-ubuntu-on-mac-disk-utility-09

If you encounter trouble, you may need to either use Terminal to partition the drive instead or clear Time Machine snapshots.

4. Installing Ubuntu

With all that accomplished, we are finally ready to install Ubuntu on our Mac! Unfortunately, high-quality screenshots were not available for these steps.

Booting from the USB

1. Reboot your Mac.

2. Select your USB drive in rEFInd to boot from it.

dual-boot-ubuntu-on-mac-ubuntu-installer-021

Running the Ubuntu Installer

1. Connect to your wireless network (if you can) and choose to install third-party software.

2. At the installation selection screen, choose “Something Else” from the bottom.

dual-boot-ubuntu-on-mac-ubuntu-installer-12a

3. Select the partition you created earlier. Click the “–” button to delete it.

dual-boot-ubuntu-on-mac-ubuntu-installer-13a

4. With the free space selected, click the “+” to create a new partition.

dual-boot-ubuntu-on-mac-ubuntu-installer-14a

5. Set the size to 4000 MB and “Use as” to “swap.”

dual-boot-ubuntu-on-mac-ubuntu-installer-15a

6. Create another new partition with the “+” button. Use all the available free space. Set “Use as” to “Ext4 journaling file system.” Set the mount point to “/.”

dual-boot-ubuntu-on-mac-ubuntu-installer-16a

7. Choose the ext4 partition under “device for bootloader installation.”

dual-boot-ubuntu-on-mac-ubuntu-installer-19a

8. Click through the remaining steps to create your user and finish the installation.

Setting Up Boot Order

Upon completion, your Mac will likely boot into Ubuntu automatically. If so, the GRUB bootloader has taken over: we need to reassert rEFInd’s control. Follow the instructions in this guide to use efibootmgr from within Ubuntu to solve the problem.

There might be a shortcut, though. If you only have rEFInd and Ubuntu installed, this Ubuntu Terminal command should set you right. However, circumstances vary, so don’t just run it blindly:

Conclusion: After Installation

You likely need to install additional drivers and software specifically for your Mac model. The best advice is to search out appropriate drivers and software changes for your hardware in particular.

19 comments

  1. Why refind?

    I used it time ago, but since a lot of time I’ve my imac (near all time in ubuntu) and I can switch system at boot pressing ALT key.

  2. Thanks for the article.

    I followed the steps here and I can’t access my mac partition again and ubuntu takes up all the hard disk spaces on my mac.
    .
    And after shutting down or restarting, it goes straight to ubuntu without showing the reFInd menu and I can’t access the macOS.

    Any help is really appreciated because my backup isn’t up to date and I’m yet to backup some important files on the mac partition.

    1. Hi Imraj,

      Unfortunately I think I have bad news. It sounds very much like you erased the entire hard drive and formatted the whole thing for Ubuntu. If so, that means that all your Mac data is gone. That’s why we recommend backing up your Mac at the top of the post before beginning. It’s likely that you selected the wrong options when installing Linux and instead of installing on a partition installed on the whole hard drive.

      There’s an outside chance that you can recover some of your data from the hard drive, but it’s not a great chance. I would stop using the computer immediately to avoid overwriting any recoverable files and use a different computer to research the best Linux-based tool for recovering files from a formatted hard drive.

      Best of luck!

      Alex

  3. Is everything easily reversible? I don’t quite know wether linux is something for me.

  4. This step-by-step tutorial is beautiful, except I don’t get why on Earth you decided not to continuing explaining things in detail as we get to ‘Setting Up Boot Order’. This is as complicated as everything above, and the link you provided assumes people are used to working with Terminal. Could you please update this tutorial?

    1. Glad the tutorial was helpful to you!

      Regarding boot order, there are a number of varying and mutually exclusive situations that can occur after installation, and capturing them all within the context of this tutorial was too broad a topic and would have lead to a fairly confusing conclusion. While the included Terminal command will likely work on the plurality of machines, it’s still only a solution for some users.

      You’re not all alone, though! The linked resource is the clearest, most effective explanation I could find and will certainly provide guidance. Here’s the link again:

      https://www.rodsbooks.com/refind/bootcoup.html#efibootmgr

  5. i did this and everything seems to work great, except i am trying to connect usb-ttl (usb- headphone looking plug) cable and i cant get it to work. I need to select the port, but i dont know what to do.

  6. If I am rocking a 2014 Macbook Pro which has already been setup with Bootcamp for Windows 10 Pro….is there any way to simply make a seperate partition in Disk Utility and use rEFInd process to add Linux to the mix?

    1. The main issue here would be a battle for bootloader supremacy between Basecamp and rEFInd, which can lead to a bad situation, sometimes preventing your Mac from properly booting at all. Mixing and matching basecamp and rEFInd is difficult, and you might encounter some wonky booting bugs. I would either stick with the Windows 10 bootcamp setup and use a Linux VM, or use only rEFInd to boot Windows, macOS, and Linux.

  7. Thank’s for this tutorial ! It seems to work on my USB key but I didn’t succeed in making a partition on my mac with the MS-DOT (FAT) Format and because of that I can’t install Ubuntu on this partition. The only thing I’m able to do is to try Ubuntu in my Mac thanks to my USB key but I can’t download folders and softwares on this temporary session. Could you help me please to solve my partition’s problem please ?

    1. What is preventing you from creating a partition on your hard drive? If Disk Utility is throwing an error, you can also try to format the disk using Terminal’s diskutil tools, which tend to be more reliable but harder to operate:

      https://www.maketecheasier.com/format-external-drive-osx/

      If you read further down the guide, you might notice that the exact format of the partition in macOS doesn’t matter. Since you’ll be turning the partition into free space when you install Ubuntu, the partition does not need to be created as MS-DOS (FAT) from within macOS. While that tends to work best, you could also format the partition as ExFat, HFS+, or maybe even APFS, though I haven’t tested that myself. Then, you’ll erase the partition during the Ubuntu installation and reformat it as ext4 as part of the Ubuntu installer steps.

      The whole purpose of creating the partition is really to make a separate chunk of the disk in macOS rather than the Ubuntu installer. The tools in macOS are more user-friendly than those in the Ubuntu installer, so we’re just “pre-staging” the formatting so we can grab it more easily during the install process.

      Regardless of whether you create the space for the Ubuntu installation in Disk Utility or in the Ubuntu installer itself, make sure to exercise necessary caution. You just always want to be EXTREMELY careful when partitioning your boot drive, because if something goes sideways, you’ve just nuked your whole OS. That’s why creating a disk clone is NOT OPTIONAL before beginning this process. I would even recommend booting into the clone once to make sure it can save you in the event of an emergency. We’ve already had one person in the comments nuke their system because they discounted the importance of those instructions, and I would very much like to avoid making it two people.

  8. Thank you for your tutorial! I had troubles just in the end. While loading the USB, the operative system loads because I hear a sound, but the screen is black. Any suggestion? I’m making the procedure on an iMac 2009. Thank you in advance

    1. This reminds me of something: a similar issue can occur on a Hackintosh when the bootloader uses incorrect graphical settings. However, that’s rarely a Linux problem, since Linux is built to run anything from a hair dryer to an aircraft carrier. When you open About This Mac from the Apple menu, what GPU is listed there?

  9. Hi Alexander,

    I have the same issue as Giovanni above. Mb Pro Early 2011, Intel HD Graphics 3000 512 Mb. The only difference is that I get a “Couldn’t get UEFI db list” when trying to install Ubuntu. Any ideas would be great.

    Cheers

    1. That’s another surprising one! The UEFI DB list error normally pops up due to SecureBoot settings. However, macOS doesn’t support SecureBoot, so no Mac could possibly cause that problem.

      That makes me think that there’s some problem with your USB’s bootloader. Make sure you followed all the instructions above about creating the boot disk with Etcher. That process is crucially important. Without a properly-formatted Ubuntu Live USB, you won’t be able to boot into Ubuntu on the USB drive.

  10. Hi Alexander,

    Thanks for the nice tutorial, it was the most complete one I could find. There is one thing however that is stopping me from partitioning my internal drive. I have a 125GB internal drive that I would like to format to a ~90GB Mojave OSX and the remainder for Ubuntu. The problem is that when I try to create a partition using either disk utility or terminal, it notifies me that the minimum size of the OSX container is 118 GB. Do you know if there is any way to shrink this minimum size? There is only around 18 GB of it which is used (I created a back up and factory resetted it).

    Thanks a lot!

    1. How are you determining the total disk usage? The terminal command du will provide the most useful stats. You might find there are actually 118gb worth of files on that partition, including system files, caches, removable files, and other junk. If not, you can try using the diskutil terminal command to push a format more aggressively. Just make sure you follow the appropriate syntax and don’t mix up mount points.

      1. Hi Alexander,

        I determined the total disk usage through the GUI, not command line (apple logo>about this mac>storage), but I solved my problem through erasing the disk completely from the start up screen you get when you reboot your mac whilst also pressing command + R. After this I could partition it, and now the OSX is working on a 90 gb drive, which is exactly what I wanted. Thanks for your reply !

  11. Hi there great article however once I begin to go through the Ubuntu installation phase I get the error message not enough space on your computer only 4.0gb which is the exact size of my USB flash drive?

    Tried many different ways and methods to fix this but still to no avail

    Ubuntu doesn’t recognise my harddrive at all let alone the partition?

Comments are closed.