Add grub menu for OS X
Solution 1
Adding the following codes to /etc/grub.d/40_custom file worked fine for me:
menuentry "OS X" {
insmod hfsplus
search --set=root --file /System/Library/CoreServices/boot.efi
chainloader /System/Library/CoreServices/boot.efi
}
and then running
sudo grub-mkconfig -o /boot/grub/grub.cfg
Tested on iMac 17,1 (Macbook retina late 2015), Ubuntu 16.04 LTS, Mac OS El Captain
Solution 2
Make sure, that the following command lists a /boot/efi partition: cat /etc/fstab
If /boot/efi is not present, you will not be able to boot into Mac OS X, if it exists you have to add the menu entry in grub like this:
- Open the file /etc/grub.d/40_custom with your favorite text editor as root. Example with the terminal:
gksudo gedit /etc/grub.d/40_custom
orsudo vi /etc/grub.d/40_custom
Then add the following lines at the end of the file:
menuentry "MacOSX" { # Search the root device for Mac OS X's loader. search --file --no-floppy --set=root /usr/standalone/i386/boot.efi # chainload the loader, pass parameters like -v directly chainloader (${root})/usr/standalone/i386/boot.efi #-v }
Save and quit
- Update the grub configuration like this:
sudo update-grub
I answered step by step so anyone who finds this answer can easily reproduce the steps. This was tested on Ubuntu 16.04 with Ubuntu installed in EFI-mode. Mac OS X: El Capitan, Mac mini.
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
I installed Ubuntu 16.04 Desktop on my MacBook Pro, and cannot boot OS X now. My disk partition table is:
Device Start End Sectors Size Type /dev/sda1 40 409639 409600 200M EFI System /dev/sda2 409640 392401823 391992184 186.9G Apple HFS/HFS+ /dev/sda3 392402944 490233855 97830912 46.7G Linux filesystem
I added menuentry in /etc/grub.d/40_custom as follows:
menuentry "OS X" { insmod hfsplus set root=(hd0,gpt2) multiboot /boot }
and run update-grub, then reboot.
Now I can see entry for "OS X", but when I choose it, it says:
error: disk 'hd0,gpt2' not found. Press any key to continue...
How can I fix it?
-
oldfred almost 8 yearsDid you install in EFI boot mode? askubuntu.com/questions/732611/…
-
Rod Smith almost 8 yearsTo elaborate: If GRUB is in EFI mode, it should be able to boot to OS X by launching the OS X boot loader, but the GRUB stanza you presented will not do that. Typing
sudo update-grub
should detect the OS X boot loader and add it automatically, but this seems to fail sometimes. Many Mac users prefer using my rEFInd boot manager to manage the boot process, rather than GRUB.
-
-
soywod almost 7 yearsWorked like a charm for me, macOS Sierra v10.12.3, MacBook Pro Retina 15"
-
Thomas about 6 yearsThis stopped working after a High Sierra upgrade. Now I get a prohibitory sign. I also tried a different path/file : /com.apple.boot.S/boot.efi but unfortunately that does not change anything (why this file? Because the timestamp on this boot.efi corresponds to my high sierra upgrade). There is something missing but I dunno what. In the mean time for desperate people, you can still boot MacOS via the Option key. After the Mac Sound, press option key until a menu appears, select "Macintosh HD" and your crappy high sierra will start. Unfortunate that the GRUB option stopped working.
-
PapaSloth almost 6 yearsHigh Sierra uses APFS on SSDs by default. You might need to find apfs.efi online and add it to /boot/grub/x86_64-efi or wherever your other .mods or .efis are.
-
Pablo Bianchi over 5 yearsCould you please add more information about what is done on each step and why is necessary?