How do I get Grub2 to boot into OS X?

21,095

Solution 1

An EFI-mode GRUB should be able to chainload the OS X boot loader, but the GRUB prober might not know where to find it. It's traditionally stored as /System/Library/CoreServices/boot.efi on the OS X root partition; but since Yosemite, it's typically stored on the emergency-boot disk instead, since the root filesystem now uses an LVM setup by default, which the firmware can't read. In any event, you may need to write a custom GRUB entry to get this to boot. See here for some basic information, although that doesn't give complete instructions for what you want.

If your Ubuntu installation is in BIOS/CSM/legacy mode, it may be harder, since GRUB can't redirect to an EFI-mode boot. GRUB has the ability to boot the OS X kernel directly, but that can be tricky to set up and may lose you some features in OS X. This is definitely fringe/bleeding-edge stuff, so I don't recommend you try it. If you care to do so, you can probably find instructions somewhere on the Internet, but I don't have any URLs handy.

Many Mac users prefer to use something other than GRUB as the default boot loader, relegating GRUB to secondary status or not using it at all. The traditional tool for doing this is rEFIt, but it's been abandoned for five years now. It still works, but if you use Yosemite or some other relatively recent options, you may have to jump through some extra hoops. I created a fork of rEFIt called rEFInd. It's actively maintained and will boot any of your OSes. You can try it out on a CD-R or USB flash drive before installing it to your hard disk, if you like. (The downloads page includes links to images for both types of media. rEFInd can boot Linux kernels directly, thus bypassing GRUB; or it can chainload to either an EFI-mode or a BIOS-mode GRUB. It can also chainload to the OS X boot loader and to both EFI-mode and BIOS-mode Windows boot loaders.

Solution 2

I have installed Debian without rEFInd. I had difficulty booting OSX from GRUB. I had to press the Alt button to boot into MacOs.

I tried several entries into the 40_custom file but no avail. I accidentally stumbled on this solution: I just created a menu entry in GRUB2 by including the following code in the 40_custom file located in the /etc/grub.d/ folder;

menu entry 'Os X' {
exit
multiboot /boot
}

Then I ran sudo update-grub

Share:
21,095

Related videos on Youtube

Carl Patenaude Poulin
Author by

Carl Patenaude Poulin

Updated on September 18, 2022

Comments

  • Carl Patenaude Poulin
    Carl Patenaude Poulin over 1 year

    I removed everything on my MacBook Pro, partitioned it into several small partitions, and installed Ubuntu, Windows and OS X. Grub2 sees my Windows and Ubuntu installs, but OS X doesn't show up in the Grub2 menu.

    I tried os-prober and it doesn't find anything. I tried the various edits to 40_custom I've seen here and here and elsewhere, but I keep getting "hd0,[blank]" does not exist.

    How can I make OS X show up on the Grub2 menu at boot?

    • Carl Patenaude Poulin
      Carl Patenaude Poulin over 8 years
      As a temporary work-around, I'm Option-booting into OS X when I need to.
  • Jonathan
    Jonathan over 6 years
    Any update on this since 2013?
  • Rod Smith
    Rod Smith over 6 years
    Apple is now using a dedicated boot partition for at least some installations. (An iMac I bought a few weeks ago is so configured, for instance.) Beyond that, I haven't looked into configuring GRUB to chainload to the macOS boot loader in ages. It should still be possible, but if the Ubuntu OS-prober isn't finding it, you'll have to go digging. rEFInd should detect it automatically. I'm still maintaining that program; the most recent release was ten days ago.
  • Jonathan
    Jonathan over 6 years
    I tried installing your amazing rEFind tool using your PPA & apt, and it installed fine and I was able to get into rEFind but it only showed Ubuntu (I have like 5 OS's on this machine. So I went back to Grub. Grub's OS-Prober finds it fine, but it says some error about a table missing when I try it, or it just has a blank screen and seems to hang. So I tried to use grub-customizer and set up chainloaders on each partition, but those also died with the same table error. Then I used my MSI bios just to straight boot into the drive, and somehow that worked. From there I put Chameleon on a USB pen
  • Rod Smith
    Rod Smith over 6 years
    @JonathanLeaders, based on your description, I suspect you've got a mix of EFI-mode and BIOS-mode OSes. If so, rEFInd would work if you uncomment the scanfor line in refind.conf and ensure that hdbios is among the options. A better solution is to install EFI-mode boot loaders for all your OSes, but that's not possible for some older OSes, like OS/2 and DOS.
  • Jonathan
    Jonathan over 6 years
    I likely do have a mix -- not because I meant to but because I think installed at least one of the modern OS's accidentally as BIOS-mode (or perhaps Windows 7 is BIOS mode I can't recall) ... Ideally rEFInd could throw a error and ask to continue -- missing OS's seems to me a failure case. I'd classify it as a bug -- especially since grub does detect these OS's. Perhaps just have refind run OS-prober and if the number of OS's differs then throw the warning and your explanation. Some of the missing OS's were EFI based (I think? Maybe not actually now that I think about it)
  • Rod Smith
    Rod Smith over 6 years
    rEFInd detects OSes at run-time, not via GRUB's OS prober. Thus, rEFInd running pre-boot cannot use OS prober; and an install script would have a hard time figuring out what rEFInd would detect to do a comparison then. rEFInd is configured to not detect BIOS-mode OSes by default on UEFI PCs because the detection method relies on the firmware, which produces one entry per hard disk, whether or not those entries work, and so would result in useless BIOS-mode entries in many cases. Also, mixed-mode (BIOS plus EFI) booting is uncommon on UEFI PCs.
  • Jonathan
    Jonathan over 6 years
    Fair enough. Thanks for your time explaining Rod :)