Introduction

Installing Windows 10 alongside with Mac OS is pretty straightforward with Apple’s BootCamp. It will ask you how much space you want to allocate for each environment, ask you for a Windows 8 or 10 ISO or CD-ROM, and then start the process. Once finished, you can select which OS to boot by pressing „alt“ when the boot chime sounds. But BootCamp doesn’t give you enough flexibility. What if you want to share data between the two operating systems, for instance? Windows can’t access Mac’s HFS+ file system and Apple’s implementation of NTFS drivers to access Windows file systems is so buggy, they only dare to give you read access. And what if you’d like to not just install a dual boot but triple or quadruple boot? Of course, you might overcome most challenges by simply using a virtual machine in VirtualBox, Parallels or VMWare Fusion. But there are some use cases where you need to be able to boot natively into an OS - and it’s not just gaming in Windows, e.g. scrolling of console output in Eclipse is only usable under Linux. Windows and OSX do too much soft scrolling and cause a growing lag between real output and display. Another advantage might be to use Docker natively in Linux instead of a VM.

I spent literally 2.5 days (that’s 36 hours) on the internet, and trying and testing to remedy all the quirks and problems. I’ve tried many things that in the end didn’t work out. To save you that time, I decided to write this guide. Please let me know if it worked or where you got stuck to make it more complete.

Overview

NOTE: The following procedure is not without risk. Do not follow it unless you know what you are doing and most of all: create a backup first ! I will not take any responsibility for loss of data or wrecked OS installations (incl. the original OSX).

Preparation

To make necessary changes to system files, you must disable the integrity checks of El Capitan

  1. Reboot your Mac and at the boot chime, press cmd-r to boot into the recovery image.
  2. Once loaded, in the top menu select Utilities->Terminal
  3. To disable the integrity protection, enter csrutil disable
  4. Type reboot to reboot into standard OSX. You can check with csrutil status if it’s enabled or not.

Installation of Windows

Preconditions

Steps

  1. Start BootCamp (Applications/Utilities/Bootcamp Assistant)
  2. Specify the downloaded ISO and select the partition sizes. Here, only the OSX partition size will be final - let Windows take the rest (for now). I used 100GB for OSX.
  3. Let Bootcamp install Windows and restart as desired.
  4. Once it’s (almost) finished and logs you in to the desktop, don’t do anything else yet! Keep the automatically started BootCamp installer open but don’t proceed yet. If you do, you might not be able to shrink the Windows partition sufficiently, and you’ll have to start over. (ask me how I know…)
  5. Start the Windows partition manager (right click on your computer -> manage -> disk management -> right click on C: -> Shrink Volume. Now, enter the amount of MB to shrink the Windows Partition. I chose a value so the final size of the windows partition is 100GB.
  6. As it’s so convenient, you can use the Windows tool to create the remaining partitions. Don’t worry, although we already have 4 partitions, it’s a GPT partitioned disk (hopefully) which doesn’t have the limitation of 4 primary disks like a MBR disk. I added a 25GB partition for Ubunutu Linux and used the remaining 250GB for a shared NTFS Data partition (all 3 OS will use it to store Documents, Source Code, Java Applications, Music, Movies). If you want you can add a partition for Linux Swap space (I use a swapfile on the 25GB partition instead). DO NOT change anything on the first three partitions !!! The first one is the EFI partition required to boot the system. The second is the HFS+ partition which contains the OSX and the third is the OSX recovery partition (the one you boot into with cmd-r).
  7. Once the partitions are configured to your satisfaction, continue the BootCamp installer.

Postcondition

You have a dual boot system with partitions prepared for Linux and data sharing. You can switch between the OS by pressing the Alt key during boot.

Installation of Linux

Precondition

Steps

  1. Load the Linux ISO image to the USB stick according to this guide

  2. Reboot the Mac and press the Alt key during boot.

  3. Select the USB stick in the boot selection menu (choose the EFI option).

  4. When prompted, choose „Try ubuntu“ and NOT „Install Ubuntu“ - once the desktop has loaded, start „Install Linux“ from there.

  5. IMPORTANT: Once you arrive at the partitioning step, do NOT let Ubuntu repartition your disk. Choose „Do something else“ - otherwise you really do something else (like pay a visit to the Mac store to re-install OSX + recovery image).

  6. Check that the first partition is recognized as EFI boot partition (/dev/sda1).

  7. Select the partition intended to install Linux (in my setup it was the /dev/sda5, 25GB) and click on „Change“. Format the disk as ext4 partition and assign it to „/“.

  8. IMPORTANT: before you continue, select /dev/sda1 as target for the bootloader installation. This will add Linux' EFI bootloader to the existing collection.

  9. Check again in the partition overview that only the partitions you want to install Linux on, or want to use as swap disk, have the „Format?“ checkbox checked. If not, start over by clicking „revert“.

  10. Let the installation finish (do not install updates during installation as the wifi probably won’t work yet). If you did not choose a swap partition, you might get a warning. Ignore it.

  11. After the installation of Linux, Windows 10 will not boot anymore and stop with a blue screen error 0xd000000e. This is because the Linux installation creates a hybrid MBR which is completely unnecessary. Windows will not boot in EFI mode but in BIOS mode instead and crash.

  12. Open a terminal and start sudo gdisk /dev/sda (if it’s not installed, reboot into Linux, try again or install with sudo apt-get install gdisk)

  13. Type p to view the partition table to verify you’re working on the correct disk. If not, type q to quit without saving your changes and try again with another device.

  14. Type x to enter the experts' menu.

  15. Type n to create an empty protective MBR. Note that gdisk won’t confirm a change; it’ll just show you a new experts' prompt.

  16. Type w to save your changes. You’ll be asked to confirm this action. Do so.

  17. Reboot into Linux (if not done already)

  18. Click on System Settings -> Display and set Scale for menu and title bars to 1.50

  19. Optional: to fix small fonts of grub during boot, execute sudo grub-mkfont -s 36 -o /boot/grub/DejaVuSansMono.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

    and add the following line at the end sudo vi /etc/default/grub:

    GRUB_FONT=/boot/grub/DejaVuSansMono.pf2
    
  20. To fix freezes with SSD disks edit /etc/default/grub so the line with GRUB_CMD_LINUX reads:

    GRUB_CMDLINE_LINUX="libata.force=noncq"
    

    then execute sudo update-grub

  21. Install and configure powertop: sudo apt-get install powertop and make it to start automatically: edit /etc/rc.local and insert the line before the one that says exit 0

    powertop --auto-tune &
    
  22. Fix keyboard layout (to fix some special characters):

    sudo su -
    echo "options hid-apple iso_layout=0" > /etc/modprobe.d/hid-apple.conf
    

Postcondition

You have a Mac which can boot to OSX, Windows 10 and Linux by pressing the Alt key during boot.

Installation of reFind

Precondition

Steps

  1. Download the reFind installer (the binary zip file)
  2. In Finder, double-click on zip file
  3. Open a terminal, go to the unzipped refind folder
  4. execute ./refind-install (this is the action which requires the integrity tool to be switched off)

Postcondition

During boot you will get a nice boot menu which automatically boots into the previously selected OS after a certain timeout.

Note: After Windows or Linux updates you might loose the reFind bootloader. If so, boot into OSX by pressing the Alt key during boot and re-install reFind. (you will have to temporarely disable integrity checks first, refer to „Preparation“ and „Cleanup“).

Installation of ntfs-3g

To be able to access the shared data partition from all OS, you must install ntfs-3g on OSX and configure it in Linux.

Linux

  1. Linux already comes with ntfs-3g pre-installed.
  2. To make it mount the shared data during boot, add the following line to /etc/fstab (replace the partition number 6 with the correct one and the mount point with the one you like):
    /dev/sda6 /data   ntfs    defaults,umask=007,gid=46 0       0
    

OSX

  1. Download and install OSXFUSE (it’s a pre-condition for ntfs-3g)
  2. Download and install Open Source ntfs-3g . Although this free edition doesn’t offer caching, it works fine and sufficiently fast. You might also choose the commercial edition maintained by Tuxera
  3. I did not follow the guidelines and did not create an entry in /etc/fstab. Instead, I did the following in a terminal which replaces the OSX original ntfs implementation with the ntfs-3g and the integration in OSX is seamless (new NTFS volumes are automatically mounted in r/w mode under /Volumes)
    cd /sbin
    sudo mv mount.ntfs mount.ntfs.orig
    sudo ln -s /usr/local/sbin/mount_ntfs mount.ntfs
    

Installation of VMWare to boot the raw Windows / Linux partition in OSX (optional)

You can not only boot into Windows or Linux natively now, but also by using virtualization tools like Oracle’s VirtualBox to boot from the raw partition. But be careful NOT to suspend the OS in native mode and then boot via VirtualBox or vice versa. This will cause disk corruption as Windows/Linux will write data to the disk assuming a wrong status once you re-start the suspended image. –> As you can also read in the „Caveats“ section, the best idea is to always shut-down Windows and Linux and never put it to sleep or hibernation (natively and virtualized). Only put OSX to sleep, nothing else.

Precondition

You have installed Windows and/or Linux accordingly.

Steps

  1. Download and install VirtualBox and its additions in OSX.
  2. Create a new Virtual Machine e.g. for Windows 10. Do not add a virtual disk yet.
  3. Open a Terminal and enter the following (replace the „4“ in line 2 and 4 with the correct partition number):
sudo chmod og+rw /dev/disk0s1
sudo chmod og+rw /dev/disk0s4
cd <path to your virtual machine>
sudo VBoxManage internalcommands createrawvmdk -filename win10.vmdk -rawdisk /dev/disk0 -partitions 1,4
  1. Open the settings of your virtual box, go to „Storage“, add an IDE controller with PIIX4 chip-set (as SATA won’t work yet) and add the just created win10.vmdk as disk to the configuration.
  2. After a reboot the permission to the devices are reset, so I created a small script to quickly boot into the Win 10 VM. Save it as „Windows 10.command“ (replace „Windows 10“ with the name you gave to the VM) :
#!/bin/bash
sudo chmod og+rw /dev/disk0s1
sudo chmod og+rw /dev/disk0s4
VirtualBox -startvm "Windows 10" &
disown
  1. To make the terminated Terminal close automatically, go to it’s Preferences -> Profiles -> Shell -> When the shell exits: „Close if shell exited cleanly.“
  2. Make the script executable with chmod.
  3. Start the virtual machine. At first startup it will install some additional drivers.
  4. If you put the VM into full screen mode, you can easily switch between OSX and Windows by swiping two fingers over your mouse. Very nice ! :)

You may do the same for the Linux raw partition.

Postcondition

Cleanup

Once everything works well and you’re happy, re-enable the integrity system check (CSR):

  1. Reboot, press cmd-r to boot into the recovery image
  2. Open a terminal and enter csrutil enable and reboot

Caveats

References

TAGS