Remove GRUB under OSX if OSX won't boot anymore

I seem to deal with the most obscure scenarios known to computing, and here’s another one.

So you’ve installed Ubuntu on your Mac running a dual boot with OSX, but you messed up and accidentally installed the bootloader to the MBR.  Well this will render your system useless as Mac’s use EFI and GPTs, rendering MBRs rather useless, outside of its MBR emulation mode that is.  However in order for it to function properly, it needs to be on your first Ubuntu partition, not in the whole disk’s MBR segment.

You could just reinstall, but that’ll will leave another icon of Tux just sitting there in your rEFIt menu.  Its a little annoying in my opinion so lets get rid of it.

Within OSX, pop open your Terminal (yeah, that thing that none of you Mac-heads ever use but us UNIX guys can’t live without).  If you’re running a Mac with only 1 hard drive then its pretty simple.  Just type in

sudo fdisk -u /dev/disk0 

See note
and just type in your password and go.  This will write a new MBR to the proper segment and remove the extra logo from rEFIt.

If you’re running multiple hard drives with ZFS concatenation, or RAID, or whatever the heck you may be doing, you’re on your own, sorry :)

Note: Be careful in performing this action, because it does mess with your MBR. I don’t think your Mac is going to be that picky with the MBR since it uses a GPT by default but it still could render your system unbootable. As such I obviously take no responsibility for your actions. You break it, its your fault, not mine.

Reference: fdisk manual macosx

Original article here.

© 2002-2012 Jeroen Diederen. Drupal theme by Kiwi Themes.