Dual Boot Mac OS X and Linux
by Sanjeeva Wijeyesakere
Disclaimer: Please read through this entire article before attempting to install or configure software. Also note that any installations you undertake are at your own risk and you should ensure that you have thoroughly read and understood the manufacturer’s instructions and caveats for each software package you install. You should also make sure you have a recent backup of ALL your files, data, software, etc. (just in case anything goes wrong).
With the release of the latest version of OS X (10.8 a.k.a ‘Mountain Lion’), I decided to upgrade my old MacBook (an early 2009 MacBook 5,2). Since this system had been through two OS upgrades (first to Snow Leopard and subsequently to Lion), a clean install was warranted to get rid of three years of cruft. However, given that certain scientific computing software is only available for Linux or Windows, I thought I would try to setup my MacBook to dual boot both OS X Mountain Lion and Linux.
The first question that arose was which operating systems I should install. On the OS X side, the answer was easy (Mountain Lion). However, given the plethora of Linux distributions, the decision was a little harder. I considered CentOS, Ubuntu, Debian and Linux Mint. After testing virtualized instances of CentOS 6, Ubuntu 12.04, Linux Mint (Debian Edition) and Linux Mint 13, I decided to go with Linux Mint 13 (MATE edition). While Ubuntu’s Unity interface looks promising, I found it to be too bold a paradigm shift to be workable as my primary user interface. MATE, on the other hand, provides the user with the classic GNOME 2 desktop environment and the version distributed by Linux Mint includes numerous UI enhancements (such as the excellent Mint menu). Having made my OS decision, here’s how I went about proceeding with the installation.
Update: When OS X 10.9 Mavericks was released, I was able to update my OS X installation without affecting my dual-boot setup. Similarly, I updated my Linux Mint installation from version 13 to version 16 by booting into the Linux Mint installation DVD and installing it [Liunx Mint] over my existing Linunx partition.
In order to setup your dual-boot system, you will need the following software:
- An OS X Mountain Lion installation disk (bootable USB drive or DVD) – you can create one from the OS X installer downloaded from the App Store.
- A Linux install disk (in my case, I chose Linux Mint).
- Refit – An EFI boot loader.
- GPT fdisk – A disk partitioning tool.
1. First, perform a clean-install of OS X (this involves re-formatting your hard drive and will result in the loss of all data, so make sure you have backed up everything (data, software, photos, e-mails, etc.) you want to save).
To perform a clean-install, boot into the OS X Mountain Lion install disk and launch Disk Utility. Then, partition your hard drive to create two partitions: an HFS+ volume for OS X and a second partition (I left this as free space) for your Linux install. Before proceeding with the partitioning and formatting, set GUID as the desired partition scheme (set under ‘Options’). Once your disk is ready, install OS X in the HFS+ partition.
2. Boot into OS X and install both, Refit and GPT fdisk. You will need to reboot the system a couple of times before you see the Refit menu at startup:
3. Boot into your Linux install disk and proceed with the installation, and partition the free space on your drive as follows:
a. 100MB for a reserved BIOS boot area
b. Your primary Linux partition
c. Linux swap area (corresponding to approximately twice as much RAM in your system).
Important: At this point, tell the installer to install GRUB (the Linux boot loader) to your primary Linux partition (in my case, this was /dev/sda5).
4. After installing Linux, reboot your system while pressing the option key, at which point you will see the Macintosh boot loader. Select the ‘Windows’ option as your boot partition (Figure 2; for some reason, the Mac’s boot loader thinks your Linux partition is a Windows installation).
Figure 2: The Macintosh boot loader.
5. When you see the Refit menu (it will look like Figure 1), select the ‘Start Partitioning Tool’ option and proceed to synchronize the partition tables. Afterwards, restart your system.
6. Confirm that everything is in order by booting into your Linux partition from the Refit menu (Fig. 1). Once more, you will see an error saying that the OS couldn’t be found (this will be fixed in the next step). Reboot your system.
7. Boot into OS X, open a new Terminal window and launch GPT fdisk using the following command (assuming OS X and Linux are installed on the first hard disk (disk0)):
sudo gdisk /dev/disk0
Enter ‘r’ (to access the recovery and transformation options) and then ‘p’ to show your partition table (you will see a list similar to that seen in Figure 3).
Figure 3: GPT fdisk’s printout of a partition map
Customizing Linux and getting things to work
One of the advantages of using Boot Camp to dual boot OS X and Windows is that Apple provides Windows drivers for your computer’s hardware. Fortunately, I found that most of my MacBook’s hardware (keyboard, trackpad, sound, etc.) worked without the need for any configuration. However, I did install the proprietary drivers for my Nvidia graphics card and Airport card (a Broadcom BCM4322 card). To identify the model of your WiFi card use the following command:
lspci -vvnn | grep 14e4.
After installing the proprietary Nvidia drivers, I followed the instructions on this site to get my Macbook’s LCD brightness controls working (this fix worked for a Linux Mint 16 installation on a MacBook 5,2).
Thus far, I have not been able to get my computer’s built-in iSight camera to work in Linux. However, since I rarely use this camera, it does not prevent me from using Linux Mint as a viable OS on the MacBook.
Almost immediately after booting into Linux for the first time, I noticed that my MacBook’s trackpad felt less responsive, requiring me to press much harder to move the mouse pointer. This was fixed by editing the synaptics configuration file (50-synaptics.conf) file in /usr/share/X11/xorg.conf.d. Simply add the following lines to the “InputClass” section of the configuration file:
Option “FingerLow” “1”
Option “FingerHigh” “10”
After making sure that everything was working, I installed my default application set:
- Web browser: Google Chrome
- E-mail client: Alpine (see my instructions on getting Alpine to work with Gmail)
- Text editor: Vi (installed by default); installed its GUI counterpart gVim
- Audio editor: Audacity
- PDB viewer: PyMOL; also installed autodock and vina
- Molecular modeling environment: YASARA
I also disabled the animations in MATE by installing the dconf editor and selecting the ‘reduced-resources‘ option under org > mate > macro > general. To install the dconf editor, open the terminal emulator and issue the following command:
sudo apt-get install dconf-editor
If you need access to Windows software like MS Office, you can try to get it running using CrossOver, which is based on the open-source Wine project, but has better support for popular Windows applications like MS Office (using CrossOver, I am able to run use Office 2010 in Linux Mint 16).
Finally, while I had intended to use MATE as my primary user interface, I also installed the Cinnamon, a desktop environment developed by the Linux Mint team and based on GNOME Shell and WindowMaker, a light-weight window manager that integrates with GNUstep.
Figure 4: The Cinnamon desktop
An alternative to a heavy-duty desktop environment is a window manager. Window managers are light-weight GUIs that offer a pleasant graphical work environment without the heft of a full-fledged desktop environment like GNOME or KDE.
Figure 5: Window Maker