Grub4Mac! Native & Easy EFI Linux Booting

Discussion in 'Windows, Linux & Others on the Mac' started by alexrmc92, Aug 6, 2013.

  1. alexrmc92, Aug 6, 2013
    Last edited: Aug 6, 2013

    alexrmc92 macrumors regular

    Feb 7, 2013
    This is a 64Bit EFI binary only at the moment. I will compile a 32 bit binary soon. This will only work on 64 Bit EFI macs!! (the ones that can run 10.8)

    What is Grub4Mac? Grub4Mac is a special compilation of Grub that allows fully native EFI booting of any OS that grub normally supports (all linux flavors, windows, etc..)

    Why? Bios emulation is slow and requires a Frankenstein hybrid MBR setup to boot windows and linux. Some of apple's older hardware doesn't do bios emulation very well or even at all (XServe). This allows GRUB to be seen as a startup disk and allows directly booting windows / linux disc media.

    How? It is just a standard version of grub with HFS/HFS+, EFI, and GUID Partition support built into the EFI binary. The folder structure is setup on a standard HFS+ partition to mimic an OS X install. This allows it to be seen as a startup drive to OS X and the EFI firmware. It also includes all modules and features unlike many distribution versions of grub.

    How do i install it?

    GRUB4Mac can be installed on an internal or external drive. It should work on just about every type of drive (USB / Firewire / Thunderbolt) except for an SD card (Mac's wont boot from the SD port).

    Step 1: At the moment GRUB4Mac requires it's own partition. This partition can be small (16MB-32MB is plenty of room). Download GRUB4Mac.dmg and restore it to whichever partition / drive you wish.


    Step 2: On the newly created drive navigate to /System/Library/CoreServices/SystemVersion.plist and add in whatever values you see fit. This sets the name and version of the OS when picking a startup disk. The default values are "GRUB" and "2.0".

    Step 3: Open system preferences and chose the grub startup disk, then restart your computer. Pick your installation CD from the grub menu and linux will boot! DO NOT INSTALL A BOOTLOADER IF YOUR INSTALLER ASKS YOU!


    Step 4: After installing linux, reboot while holding option (alt). Choose your OS X partition and boot into OS X. On the GRUB4Mac drive navigate to /System/Library/CoreServices/Grub/Grub.cfg and open it in TextEdit. You will need the UUID of the partition you installed Linux on to create an entry for it. I will have templates available in the near future for this.

    Note: You can get the UUID in grub by pressing C during the boot countdown. Execute the following commands in the console. Make sure no external drives are plugged in!

    insmod ext2
    root (hd0 (press tab on this command not enter)!
    GRUB should spit out a list of partitions and UUID numbers, write the one down that has an ext* filesystem. This is your linux partition.

    IMPORTANT! I take no responsibility for any harm caused to your computer using this software. While i believe it to completely safe and personally use it myself, i will not guarantee any results.

    At the moment, i only have entries for the CentOS 6.4 installation CD. I am working to add more so please be patient. You can always manually edit Grub.cfg to add your own. Templates for after install booting are also on their way

    Verified Working Systems

    XServe - Early 2009
    MacBook Air - Mid 2013

    Change Log

    Version 0.1 -
    First Release
    Supports CentOS 6.4 Installation Media Only!!
    Post your results! Let me know what works and doesn't work and ill do my best to get it fixed in a timely manner.

    Attached Files:

  2. alex0002 macrumors 6502

    Jun 19, 2013
    New Zealand
    What about the existing grub-efi - for example, the one comes with gparted-live and others? Doesn't that already boot linux and others on EFI/UEFI and support GPT etc?

    I agree that bios emulation is slow and the hybrid MBR approach is the work of the devil, but I'm just wondering why I'd want to use this one and not the existing GRUB EFI or refind?
  3. alexrmc92, Aug 6, 2013
    Last edited: Aug 6, 2013

    alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    This is grub-efi, compiled straight from grub source (Version 2.0). Some modules were included in the binary to allow it to boot from an HFS / HFS+ partition and other hardware modules. It also includes more modules than standard grub packages to support more OS's and configurations.

    Normal grub-efi installs on the EFI system partition, which cannot be used as a startup disk thus requiring you to hold option at every boot to pick grub. It also will always be labeled EFI boot in the boot manager and cannot have custom icons.

    Grub4Mac installs on a HFS / HFS+ partition and has the necessary support files to be seen as a startup disk. It can been chosen from the list of startup disks (in system preferences) and boot by default upon restart. It will display the partition name in the apple boot manager and allows for custom icons.

    You can also use it to boot install cd's directly on a mac without bootcamp or any bios emulation involved. This is particularly useful on the XServe which does not even include bios emulation in the firmware.

    rEFInd may work for you, but i don't particularly like how it installs on the system. Grub4Mac uses the stock apple boot manager exactly like it should. It loads grub as if it were an OS X install. rEFInd also does not work on XServe's, at least not the early 2009 model for whatever reason.
  4. alex0002 macrumors 6502

    Jun 19, 2013
    New Zealand
    Thanks for the clarification on adding the HFS / HFS+ and other features.

    In some ways I like the separation of boot manager and bootloader approach taken in rEFInd, but I guess that's a matter of preference.

    However, rEFInd does appear to allow installation on the HFS+ system partition (both options supported).

    In any case, it's good to have another option.
  5. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    I agree, but as i see it we already have a very good boot manager (the one apple put on our macs) While grub can be a boot manager it is fairly easily reduced to only a boot loader by removing modules.

    Having the default boot manager chain load another boot manager seems dirty to me. I'm not saying it's a bad solution, but natively executing grub seems much more vanilla.
  6. GreyMatta macrumors regular

    Jul 29, 2007
    is this an easy way of getting Windows 8 to install and boot from a USB 3 external HDD?
  7. starikarp macrumors member

    Apr 27, 2013
    More OS's? Does it supports BSD? FreeBSD for example which I want to install, please?

    Thank you.
  8. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    This will let you run any OS that grub supports without bios emulation. This includes any variant of unix (linux, bsd, etc...) or windows. As long as your machine uses 64Bit EFI and you can write grub config files.

    I have a lot of default config files for other distributions coming soon along with a 32bit EFI binary.
  9. jamesarm97 macrumors 65816

    Sep 29, 2006
    I can't wait to try it. I was actually searching this morning on ways to boot windows 8 64bit on my mac without going through bootcamp since it only supports installing windows on the internal drive. I wanted to use my thunderbolt external drive. The instructions mention getting the UUID with no external drives plugged in. Can I get the UUID of a windows partition on the thunderbolt drive?
  10. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    I only said that because most people install on their main drive.

    Anyways yes you can do that with Grub. When you find the UUID with grub you may have to try

    root (hd1 "press tab"
    and further increased hd numbers to find your thunderbolt drive. I really should make a video lol
  11. jamesarm97 macrumors 65816

    Sep 29, 2006
    I'm no grub expert, what would I add that will allow me to boot to a windows cd like the example of the linux boot cd (windows 8 if that matters). I would imagine it would be /cd0/??? but I am not sure of the rest.
  12. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    This may be wrong but something like this should work

    menuentry "Windows 8 Install DVD" {
      insmod iso9660
      insmod fat
      insmod ntfs
      insmod chain
      chainloader (cd0)/EFI/Microsoft/Boot/bootmgfw.efi
  13. jamesarm97 macrumors 65816

    Sep 29, 2006
    Are the files / directories case sensitive? Also, these are the .efi files in the




    Looks like a few choices
  14. lion10 macrumors newbie

    Nov 22, 2010
    Install Grub4Mac on "Mac OS free" Mac Mini

    An other variant of grub bootloader which is somehow simpler in handling; - really a great idea alexrmc92! :)

    My question, is there a simple way to install Grub4Mac on an fully empty / clean "Mac OS X free" Mac computer?

    I know many are wondering how someone can just install a Mac OS free Mac...

    Well, the answer is quite simple. I try to use a Mac Mini as a FreePBX phone server. Unfortunately, until now I found no way to install FreePBX (CentOS 6.4) natively with EFI. Although the latest CentOS 6.4 installation media should be (U)EFI compatible, these do not start in EFI mode (-->EFI boot). I reproduce this issue with all CentOS installation variants at iMac 2006 to 2009 and Mac Mini 2010. :mad:
  15. alex0002 macrumors 6502

    Jun 19, 2013
    New Zealand
    I've not tried all of this, but one suggestion - perhaps you can boot your Mac Mini using gparted-live written to USB, as it has a working grub-efi.

    Be prepared to change some of the kernel options in /EFI/boot/grub.cfg on the USB. For example, on a 13-inch cMBP with Intel HD Graphics you might need to remove the kernel parameter "i915.blacklist=yes" in order for X-windows to start up.

    This is the part I haven't tried - once you can boot gparted-live on the Mac Mini, then add another entry to grub.cfg so that grub loads the kernel and ramdisk for the CentOS installer.
  16. lion10 macrumors newbie

    Nov 22, 2010
    Many thanks alex0002 for this information.

    Yes, - I had the same idea by reading across the CentOS 6.4 forum. The solution was to build with the tool "ISO2USB" a bootable CentOS 6.4 USB installation media. (I then had only to copy the "EFI" and "images" directory manually from the CentOS install media to the new USB flash drive.)

    That USB install media was recognized by the Mac EFI as a bootable EFI device, the "EFI boot" option appeared at start up. I was now able to install CentOS 6.4 in EFI mode quite easily. No edit was needed at the grub.cfg. :)

    However, there turned up a new grave error in the CentOS "kickstart / anaconda subsystem". I was able to install only a stock CentOS, - every additional install script like FreePBX was ignored. :( So, everything is now "on hold" again...
  17. smaugz macrumors newbie

    Jan 18, 2014
    alexrmc92, thanks for this.

    Couple questions:

    1. Is this project living somewhere like Github, sourceforge, etc?
    2. Have you created any other setups (other than Centos 6.4?)
    3. Would you consider posting info on how to make setups for other installs (for example, ones that install linux off a USB stick.)
    4. Any updates?
  18. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    Work has been busy so i haven't had much time to do any updates. I would like to make a guide on how to compile it and have the source available. GRUB itself is unchanged, but the configuration files need tweaking before compiling.
  19. southpaul macrumors newbie

    Mar 3, 2014
    good idea!

    I'm certainly interested in this approach, it would be great to be able to use Mac's own bootloader. I'm hardly a techie, so I hope you are able to further develop and release an updated version. Good luck with it.
  20. AirThis macrumors 6502a

    Mar 6, 2012
    It seems to work on a Late 2009 Mac Mini. I'm booting Linux from a usb stick.

    Approximately 1 time out of 5, program execution gets stuck after Grub passes over control to RHEL 6.5. There is a blank screen and absolutely nothing happens. I'm not sure if the issue is with Grub4Mac or elsewhere.

    Anyway, it's nice little project. :)

    I'm using this menuentry to boot, just in case anyone is curious.

  21. alexrmc92 thread starter macrumors regular

    Feb 7, 2013
    It's been a while since my last update. I'm working on some finishing touches and will have an updated version out, as well as the 32bit package for older macs (Macs that can't natively run ML).

    I added support for standard PXE booting using gPXE. Although i would like to use the newer iPXE it will need some patchwork before being able to operate on Apple's EFI implementation.

    I've been using the PXE feature to use Ubuntu's MAAS system on a cluster of Xserve's and it's been working great.

    Stability is better as well, some grub modules were causing hanging issues so i have removed them out of the default EFI binary, the only built-in modules included in the new version are "hfsplus" and "part_gpt". Everything else will have to be loaded with "insmod" This keeps the EFI binary small and quick.
  22. serscene macrumors newbie

    Sep 7, 2014
    ipmi crash on Xserve

    using grub4mac as alternative to using another EFI bootloader which was crashing during ipmi sequence:

    IPMI BT: timeout in XACTION [ H2B ]
    failed 2 retries, sending error response
    IPMI: BT reset (takes 5 secs)

    Turns out I'm ending up at the same road block with GRUB4Mac.

    I found a solution to the problem on CentOS forum,

    "Try appending "ipmi_si.trydefaults=0" to the kernel command line as you boot."

    Is there a way to create this append using GRUB4Mac?

    Also trying to install CentOS 6.5, not 6.4, from cd0. Should this make any difference seeing that vmlinux and initrd are properly located grub.cfg file.
  23. drkimjb, Sep 11, 2014
    Last edited: Sep 14, 2014

    drkimjb macrumors newbie

    Sep 15, 2010
    Thanks . Alexrmc92..
    Finally I found this GRUB4Mac

    Please understand my poor English

    1. How can I resize the partition of GRUB4Mac to 100~200M.

    GRUB4mac file is just not more than 3m but the partition is about 90 GB .
    I tried to restore a partition with the image of GRUB4Mac, and then I could resize to 5.6G with the mac diskutil. but I cannot reduce the size to 100~200M.

    2 .How can I edit grub.cfg to boot with Mac, Ubuntu and Windows 8.1
    I 'm not good at Grub2.
    I have iMac, and I want multi-boot ( windows8.1 , ubuntu, mac,..)
    I tried to edit grub.cfg like the following first.
    I can see the menu of GRUB4Mac but I can't boot with windows or something.
    menuentry "Windows 8.1" {
    insmod ntfs
    insmod chain
    set root=(hd0,3)
    chainloader /Windows /boot/EFI/bootmgfw.efi

    menuentry "OS X" {
    insmod hfsplus
    insmod chain
    set root=(hd0,4)
    chainloader /System/Library/CoreServices/boot.efi
    Help me please .. I 'm a newbie. Thank you.
  24. Bialogs macrumors newbie

    May 6, 2015
    Does the current distribution of GRUB4Mac that is linked as the first post contain these changes? What sort of config did you use to get this functionality?

    I'm really interested in the ability to add an old Xserve I have sitting around as a MAAS node.

Share This Page