How do I install Linux on a Mac?
Linux is an interesting and slightly less well-known operating system - although Macworld's tech-savvy readers are likely to know at least a little about it. In the dual world of Windows vs Apple, Linux sits off to one side, powering serious servers and being used by software developers.
There are lots of great reasons to be interested in Linux. Like Mac OS X, it has a heritage with Unix (or at least a Unix clone called GNU). Some Linux desktops, like Ubuntu Unity, are similar in nature to OS X.
Linux is loved by developers, and if you're into coding it can be great to move into Linux. It turns out that OS X is (in many ways) better than Windows for software development, but Linux is even more comfortable to work in. Its open-source nature ensures that code is freely shared, and programs and solutions are often just an apt-get away (don't worry, you'll learn what apt-get is later).
Linux is also a very light operating system, and you can install the latest version Linux on an older Mac and it'll run much faster than older versions of OS X. Apple Macs make great Linux machines.
How to install Linux on a Mac: Which version of Linux to pick
The first thing you need to know is that there are different versions of Linux around. These are known as "distributions" and each offers a different experience. Which one you pick depends on what kind of experience you want. Here are three to choose from:
- Ubuntu. This is the most popular choice for beginners, and it uses a desktop interface called Unity, which is very similar to OS X. It's probably the best place to start.
- Linux Mint. This has made waves recently, and is a great alternative to Ubuntu. You can pick a range of desktops (Cinnamon or MATE are the most popular). While Unity feels like OS X, Mint feels a little more like Windows.
- Kubuntu. This blends the Ubuntu version of Linux with a different desktop called KDE Plasma. The desktop is generally considered to be more powerful, and certainly has a lot more features.
We'd suggest you start with Ubuntu, but it's pretty easy to install all different versions of Linux and there's nothing stopping you from trying out all three (and more) before settling on the one you want.
How to install Linux on a Mac: Use virtualisation software
By far the best way to install Linux on a Mac is to use virtualisation software, such as VirtualBox or Parallels Desktop. Because Linux is capable of running on old hardware, it's usually perfectly fine running inside OS X in a virtual environment.
VirtualBox is a free environment, although Parallels Desktop is more powerful and an easier installation, so we'd advise using Parallels Desktop for Mac first. A free 14-day trial is available from Parallels.com. Follow these steps to install Linux on a Mac using Parallels Desktop.
- Download a Linux distribution file and save it to your Downloads folder. The file will have an ".iso" extension. Click here if you want to download Ubuntu.
- Open Parallels Desktop and choose File > New.
- Choose Install Windows or another OS from a DVD or image file. Click Continue.
- Parallels automatically finds all the compatible ISO files on your system. Highlight Ubuntu Linux (or the one you want to install) and click Continue.
- Fill out the Full Name, User Name, Password and Verify Password fields. Click Continue.
- The virtualisation file will be saved in your Users folder by default. Click Location if you want to change it, otherwise just click Continue.
Parallels will install Linux inside the virtual environment. Click it in the Parallels Desktop Control Center to start using it.
How to install Linux on a Mac: Replacing OS X with Linux
Running Linux inside a virtual environment is all well and good, but if you're a more seasoned Linux user you may want to replace OS X completely and run just Linux. If so, you'll free up more of the computer's resources and get a great Linux machine.
Installing Linux on a Mac isn't quite as straightforward as installing it on an older Windows machine, and you need to make a few tweaks in the installation process. You'll need a USB Thumb stick (with at least 8GB of spare space). You will also lose your OS X installation (we don't recommend trying to dual-boot OS X and Linux, because they use different filesystems and there are many reported problems).
Be warned that you'll also lose your OS X Recovery Partition, so returning to OS X can be a more long-winded process, but we have instructions here on how to cope with this: How to restore a Mac without a recovery partition
Here's how to go about installing Linux on a Mac:
- Download your Linux distribution to the Mac. We'd recommend Ubuntu 14.04.4 LTS if this is your first Linux install.
- You need to convert the ISO file to an IMG so OS X can open it. Open Terminal and enter cd Downloads/ then hdiutil convert -format UDRW -o ubuntu.img ubuntu-14.04.4-desktop-amd64.iso. The file is converted, and OS X adds ".dmg" to the end.
- Enter diskutil list and note all the attached drives.
- Now insert the USB Flash Drive and enter diskutil list again, note the disk number of the new drive. In a Mac with a single drive this will be /dev/disk2 but check and double check. You don't want to erase the wrong drive.
- Enter sudo diskutil unmountDisk /dev/disk[n], where n is the number of your drive. IE: sudo diskutil unmountDisk /dev/disk2.
- Enter sudo dd bs=1m if=~/Downloads/ubuntu.img.dmg of=/dev/rdisk[n]. Again, replace [n] with the number of your thumb drive. This wipes all of the content of the thumb drive and creates a Linux installer.
- OS X displays an Alert saying "The disk you inserted was not readable by this computer." Click Eject.
- Shut down your Mac and attach the USB stick.
- Power up the Mac while holding down the Option key.
- Choose the EFI Boot option from the startup screen and press Return.
- You will see a black and white screen with options to Try Ubuntu and Install Ubuntu. Don't choose either yet, press "e" to edit the boot entry.
- Edit the line that begins with Linux and place the word "nomodeset" after "quiet splash". The whole line should read: "linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash nomodeset --. (See screenshot, below.)
- Press F10.
- Ubuntu boots into trial mode.
- Double-click the icon marked "Install Ubuntu".
- Select English and choose Continue.
- Select "Install this third-party software" option and click Continue.
- Click Yes to the /dev/sdb alert.
- Select "Erase disk and install Ubuntu" and click Continue.
- Ensure that Select Drive is displaying the main hard drive. Click Install Now. Click Continue in the alert window.
- Select your location on the map and click Continue.
- Choosing your keyboard layout and click Continue.
- Enter the name and password you want to use.
- Click Continue and Linux will begin installing.
- When the installation has finished, you can log in using the name and password you chose during installation.
Above: Step 12
When you install Linux on your Mac, it removes all of the OS X installation including the recovery partition. If you want to reinstall OS X, you'll have to create an OS X recovery disk using the thumb stick.