How To Dual-Boot OSX and Ubuntu
How To Dual-Boot OSX and Ubuntu
You can leave the Scheme field untouched. Hit Erase, and the drive should be wiped and formatted
within a few seconds. You can check that the process worked by opening up Terminal (also in /Applications/Utilities/) and running the diskutil list command, which will print out a list of your drives and
their partitions, like this:
The above image tells me that the USB drive is accessible at the path /dev/disk1, which has the correct
partition scheme, format, and label. Disk Utility should also say the drives path, in the Device field.
Your drive was probably automatically mounted by Finder after it was created, so next you want to
unmount it via Terminal using the command:
diskutil unmountDisk /dev/diskN
where N is the number at the end of the drives path, which in my case is N = 1. Now, your drive is
ready to be made into a bootable live USB for installing Ubuntu. Unfortunately, OS X doesnt play well
with the ISO image format that distributions like Ubuntu typically come in, so we have to convert it to an
Apple disk image (.dmg) file instead. All this requires is running the following command in terminal:
hdiutil convert -format UDRW -o /path/to/image.dmg /path/to/image.iso
replacing /path/to/image with wherever your file is, e.g. /Users/Nailen/Desktop/Media/ubuntu-15.04desktop-amd64. This should finish in under a minute, after which we can go ahead and clone this image to
the USB drive with:
sudo dd if=/path/to/image.dmg of=/dev/rdiskN
which will require your password. The reason we use rdiskN instead of diskN here is that the former basically just writes the data from the start of the disk, whereas the latter has to pass through more
layers of software abstraction. This process can take a while, but once its done you should see a message
confirming that the image has been copied, like this:
(I used a .img extension instead of .dmg, but it shouldnt matter.) Dont worry if Finder complains about
not being able to read the drive, thats normal. If you made it this far, your USB drive should be a bootable
instance of Ubuntu, from which you can install the OS on your computer itself.
When you get to the Installation type step, STOP! This is the point where we configure that partition we
made earlier for Ubuntu. Select Something else, like so, and continue:
4
This will bring you to a rudimentary partition editor. Find the partition you created earlier, which should
have the same size, be of format HFS+, and be almost entirely empty; click on it, and then click - to erase
it to free space. If youre still not sure you have the right partition, you can use the pre-installed GParted
Partition Editor to finish this section, as it has a similar interface but provides more detail. Now, we have
to create at least two partitions: one to use as a swap for your RAM, and one to use for everything else. To
do this, make sure the free space is selected, and hit the + button. This will bring up a window like this:
Set the partition size to the same as your RAM (remembering that 1 GB = 1024 MB), and the Use as:
field to swap area, then hit OK. Repeat this process, instead letting the size be as large as the remaining
free space, and selecting the partition for use as an ext4 filesystem, with the mount point /. Make a note
of the index of this partition, i.e. the N in /dev/sdaN. Those who have used Linux before might also at this
point want to create separate partitions for /boot, /home, et cetera, which isolates disk errors and allows
parts of the filesystem to be encrypted independently, but this is not necessary. Once youre done, select
the ext4 partition as the Device for boot loader installation, and continue with the rest of the installation.
When it finishes, youll be prompted to reboot or continue testing Ubuntu; you should opt not to reboot
since we still have one thing left to do.
sudo cp ~/Downloads/boot.efi ./
Then, we have to create the SystemVersion.plist file. If youre familiar with a command-line text editor
such as vim, you can just run it with sudo; otherwise the easiest way to do this is probably to create the
file in your Documents folder with TextEdit, and then copy it over via the same method as boot.efi. Either
way, it should contain the exact following contents:
<xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<dict>
<key>ProductBuildVersion</key>
<string></string>
<key>ProductName</key>
<string>Linux</string>
<key>ProductVersion</key>
<string>Ubuntu Linux</string>
</dict>
</plist>
This defines a dictionary of key-value pairs identifying the Ubuntu OS. The indents can be done with
tabs or spaces; theyre purely stylistic, as the XML tags will be parseable even without indentation. Once
this is in the CoreServices folder, were almost done! All we have to do is bless the partition for booting,
and set the boot flag, like so:
sudo bless --device /dev/disk0sN --setBoot
In this case, N is the index of the boot loader partition; because I have a bunch of partitions for
my Arch Linux installation, and I accidentally created the boot loader partition after installing Ubuntu,
N = 12 on my machine. You should check that you have the right number, and that the partition is also
on disk0, by opening up Disk Utility again, and looking at the Device field of the Ubuntu Boot Loader
partition:
The --setBoot flag sets Ubuntu partition as the default boot device, so if youd prefer to keep OS X as your
primary OS, just dont include it in the command.
If youve made it this far, your Ubuntu installation should work! Unplug the USB installation drive,
and give it a try by rebooting your computer, while holding down the option key. In addition to your
Macintosh HD, you should see a new image of a hard drive, labeled EFI Boot. This is Ubuntu, and
selecting it will allow you to boot to your new Linux desktop.