Ubuntu – How to stop Ubuntu taking over as default OS on Mac, or at least reset macOS as default from within Ubuntu

dual-bootgrub-efigrub2mac

It seems annoying that when you boot into Ubuntu on a Mac it takes over and becomes the default OS, even if something else (e.g. macOS or Boot Camp Windows) was previously the default.

The only way I have found to get back macOS as the default boot OS is to fully boot back into macOS (using Alt/Option on boot to select it), and then manually set macOS back to being the default using 'System Preferences/Startup Disk', which seems a bit excessive.

I'm actually going to post my own command line answer which I've worked out.

But I am also genuinely very happy to hear and up-vote any other command line or GUI-based answers which can set macOS back to being the default from within Ubuntu. (Or can prevent Ubuntu from taking over as the default in the first place!)

Best Answer

  • When Ubuntu is installed, a EFI/BOOT/BOOTX64.EFI file is place on the first EFI partition. This is the file that can be selected to boot from the Mac Startup Manager. Also, the GRUB file EFI/ubuntu/grubx64.efi and secure boot file EFI/ubuntu/shimx64.efi are both placed in the first EFI partition. Having the firmware boot either of these two files will result in the booting of Ubuntu. The difference on a Mac is that the booting of EFI/ubuntu/shimx64.efi will result on configuring the Mac to always boot Ubuntu. Since EFI/BOOT/BOOTX64.EFI and EFI/ubuntu/shimx64.efi files are identical, using the Mac Startup Manger to boot Ubuntu will result in Ubuntu becoming the default.

    Below are possible ways to avoid Ubuntu becoming the default.

    • Copy EFI/ubuntu/grubx64.efi to EFI/BOOT/BOOTX64.EFI. The problem with this solution is that an update to Ubuntu may undo this change.
    • Create a new EFI (or possibly a FAT or ExFAT partition) and install a UEFI shell. Configure this shell to boot EFI/BOOT/BOOTX64.EFI. This will result in a new item appearing in the Mac Startup Manager. You can change the icon and label of this item to distinguish this item from the other choices.
    • Create a new EFI (or possibly a FAT or ExFAT partition) and install rEFInd. Configure rEFInd to silently instruct the firmware to boot EFI/BOOT/BOOTX64.EFI. This will result in a new item appearing in the Mac Startup Manager. You can change the icon and label of this item to distinguish this item from the other choices. Although you may wish to use rEFInd as the default startup manager instead of the built‑in one.