I installed Ubuntu in dual boot on my Mac without using rEFInd. Initially everything worked fine, I could access both systems. Later, in an attempt to remove Ubuntu, I deleted a partition I had created for swap and since then GRUB has replaced the Mac's boot loader. So now I can only access Ubuntu. I would like to be able to access macOS again without losing any data. How can I do that?
The GParted image shown below was taken while booted to Ubuntu.
Update
Thanks to internet recovery, I was able to open the Terminal. Below is the result.
Best Answer
When the
diskutil
command or the Disk Utility application is applied to a drive which has Linux type partitions, the partition type GUID stored in the GUID Partition Table (GPT) for a macOS partition is often changed toFFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
. The GParted image you posted in your question will not show this change. In other words, if the partition type GUID for/dev/sda2
had been changed from7C3457EF-0000-11AA-AA11-00306543ECAC
toFFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
, then the file system shown in GParted will still remainapfs
. This is because GParted looks at the content of the partition to determine the filesystem and not at the partition type GUID. However, the Mac firmware (Mac Startup Manager) does look at the partition type GUID when displaying possible operating systems to boot from.One possible way to determine, if the partition type GUID for
/dev/sda2
is7C3457EF-0000-11AA-AA11-00306543ECAC
, is to view the output from the command shown below. This command needs to be entered in an Ubuntu Terminal application window. (From the Ubuntu desktop, press the key combination option+control+T to open a Terminal application window.)You should see the code
AF0A
. If you see codeFFFF
then partition type GUID is probablyFFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
. If necessary, you can change the partition type GUID back to7C3457EF-0000-11AA-AA11-00306543ECAC
by entering the command and interactive input shown below. Here I assume number for this partition is2
. If not, then make the appropriate substitution below.A Clarification Regarding the Question
In your question you state "GRUB has replaced the Mac's boot loader". Actually, this is impossible. The Mac boot loader is implemented in firmware. In your case, the Macs boot loader is boot loading GRUB and then GRUB is boot loading Ubuntu.