pink cylinders

More than Four

...there's an axis for that.

iMac; Linux; GRUB; OS X: Can't we all just get along?

I'm not really a fan of OS X. I'm sure the underlying OS is fine - after all, It's a Unix system. I know this! - but the Finder; the keyboard layout; the relentless updates; but most of all the fuzzy text aggravated me.

After some success with a Bootable USB drive containing a 64-bit Linux Mint ISO, I decided to follow Clem's excellent instructions here: 

http://community.linuxmint.com/tutorial/view/1643

and install Linux Mint 17.1 on my 2013 iMac.

Now, I'm not crazy: I resized the primary OS X partition and divided up the remaining space, just as Clem recommended:

/dev/sda4    30 GB   ext4
/dev/sda5     4 GB   swap
/dev/sda6   500 GB   ext4 

After the Linux install completed, I also followed the "Fixing the boot order" instructions, about installing efibootmgr and making the EFI boot Linux first. Supposedly this was to achieve:

"The boot order should now indicate that it will run Mint first, and if that ever came to fail.. it would then run Mac OS. In other words our MacBook now boots into Grub. From there we can select Mint or press Escape and type "exit" to boot into Mac (we'll fix the Mac grub entries to make it exit without having to type anything later on in this tutorial)."

I'm not sure what I did wrong... maybe nothing. Maybe we're just expected to have a complete understanding of EFI and GRUB and bootloader configuration in general, at this point.

Anyway, bottom line: I never saw GRUB, or a menu of boot options, or anything. It just booted straight into Linux. Fortunately the Mac HD volume is visible and accessible under Linux, and I've been able to copy my files over as the need arises, from inside Linux Mint. Excellent.

But what if I want to execute a Mac OS X application natively, for some reason? Dammit, I want to dual boot this thing. The normal Option- key (Mac Boot menu) no longer works, and neither does Option-R (to get to the Mac Recovery partition).

After some research, I learned that pressing 'c' during the boot process gets us to the GRUB command line. Now I could use the ls -l command to list the partitions:

hd2,gpt1      fat efi
hd2,gpt2      hfsplus   'Mac HD'
hd2,gpt3      hfsplus   'Recovery HD'
hd2,gpt4      ext *                       29 GiB
hd2,gpt5      -                            5 GiB
hd2,gpt6      ext *                      438 GiB

but this still left me with no understand of how to boot into one of them. More research:

http://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time

OK, so I learn about GRUB 2 and the significance of the /etc/grub.d scripts and the /etc/default/grub file, and commenting out the GRUB_HIDDEN_TIMEOUT=0 setting by prefixing it with '#'.
 
Dedoimedo has a really nice tutorial on GRUB here:
 
That taught me how any changes to these grub config files should be followed up with:
 
$ sudo update-grub
 
After that, when I restart, I get the boot menu! Yay. From the partition list (see above) I'm pretty sure that I should be able to add a menu option for the OS X partition.
 
More research:

http://askubuntu.com/questions/179689/mac-os-x-wont-boot-from-grub-menu-in-ubuntu-precise-on-apple-mba5-2

It suggests adding the following to the /etc/grub.d/40_custom script:

   menuentry "OS X" {
insmod hfsplus
set root=(hd1,gpt2)
chainloader /System/Library/CoreServices/boot.efi
}

Long story short: that works perfectly. After sudo update-grub and a reboot, we have a menu and an option that will boot into OS X.

Thanks, Internet!