Delete Ubuntu dual boot on Mac w/ rEFInd

I installed Ubuntu-Gnome 16.10 using 8 GB Swap and nearly 42 GB main partition on my Macbook Pro and then changed the DE to Unity. I want now to delete the whole Ubuntu thing and free my 50 GB space so that I can add them to my macOS partition. I used rEFInd to install Ubuntu.

Can anybody tell me step-by-step what should I do to delete Ubuntu and how to make one big partition as in the beginning? Thanks in advance. :)


Removing Ubuntu

  1. Open up Disk Utility from /Applications/Utilities.
  2. Click on your hard drive in the left-hand sidebar (the drive, not the partition) and go to the "Partition" tab. Find the Ubuntu partition you want to remove (you probably labeled them when you first created them).
  3. Click on the partition you want to remove, then click the small minus button at the bottom of the window. This will remove the partition from your system.
  4. Click the corner of your Mac partition and drag it down so it fills up the free space left behind. Click Apply when you're finished.

Your Mac may take a minute to perform the necessary processes, but when it's done, your system will be back to its original Macintosh self. If you had rEFInd installed on your system, you can leave it there—it isn't going to hurt anything, but if you want to completely remove it do the following steps.

Removing rEFInd

As stated in the official documentation,

I recommend stopping here, because the procedure for completely removing rEFInd from a Mac depends on your installation method and tends to be challenging for many Mac users, who are unfamiliar with the necessary command-line tools.

Basically, if you just want your Mac back, just follow the procedure before this and leave rEFInd alone. But, if you want to completely remove rEFInd, then continue.

  1. You must first determine where rEFInd is installed. This can be any of several locations:
    • If you installed rEFInd 0.8.3 or earlier with the default options, or if you used the --notesp option with rEFInd 0.8.4 or later, it will be /EFI/refind on your main partition.
    • If you installed rEFInd 0.8.4 or later with the default options, or if you used the --esp option with rEFInd 0.8.3 or earlier, it will be in EFI/refind or EFI/BOOT on the ESP.
    • If you used the --ownhfs option to refind-install, rEFInd will be in the System/Library/CoreServices directory on the volume you specified.
    • If you installed rEFInd manually, it will be wherever you put it.
    • In all cases, there could be duplicate (inactive) rEFInd files in unexpected places. This is particularly true if you tried installing rEFInd multiple times, each with different options to refind-install. Thus, if you delete rEFInd and it still comes up, you may have deleted the wrong files. (Note that dragging files to the Trash may have no effect, though—at least, not until you empty the Trash.)
  2. If necessary, mount the ESP or rEFInd-specific HFS+ volume, as described in Installing rEFInd Manually Using Mac OS X. (The mountesp script that comes with rEFInd will handle this task.)
  3. Verify that rEFInd is installed in the directory noted in step #1. If a refind.conf file is present, rEFInd is almost certainly installed in that directory. If not, it's not rEFInd there and you should not proceed. Be extra cautious about deleting the System/Library/CoreServices directory, since that's the default location of the OS X boot loader! Never delete this directory from your OS X root (/) partition, only from the partition you specified to refind-install using the --ownhfs option.
  4. Once you've identified the rEFInd directory, delete it, or at least the rEFInd boot file. This file may be called refind_x64.efi, bootx64.efi, boot.efi, or conceivably something else. You may need to use sudo rm at the command line to accomplish this task, as in sudo rm -r /Volumes/ESP/EFI/refind.

All credit for this information goes to the sources cited below.

Sources

  • LifeHacker Uninstall Windows/Linux after dual-boot
  • rEFInd documentation

WARNING:

I have followed @Owen Hines answer and removed the partition from the drive using disk utility. However, this caused me some problems: removing the partition worked, but the free space was not automatically reclaimed by the main partition. I decided to re-boot my mac, hoping it would change something, but it booted into reFind and did not show the Mac OS X, so I could not boot into it anymore!

Luckily, I was not the first one to experience this problem and there are many posts on StackExchange dealing with this problem in detail. Most helpful for me were:

https://apple.stackexchange.com/questions/305706/os-volume-shows-as-type-ffffffff-ffff-ffff-ffff-ffffffffffff

and

https://apple.stackexchange.com/questions/282550/data-not-backed-up-partition-type-ffffffff-ffff-ffff-ffff-ffffffffffff

The problem was that removing the partition somehow left the main partition with an unknown type (FFFF...), so the partition map had to be changed by removing and re-adding the partition with the correct type. As far as I understand the process (not too savvy on this), the partition type depends on the OS version you have, so check which one to use. This is explained in the answers above.

Removing and re-adding the partition worked fine for me. When verifying them at the end (also explained in the posts linked above), I had to unlock my the volume first, because it was an encrypted APFS container. Refer to: https://derflounder.wordpress.com/2017/11/04/unlock-or-decrypt-an-encrypted-apfs-boot-drive-from-the-command-line/

Finally, I could boot again into reFind and choose to boot the Mac OS! However, the partition still had not reclaimed the size of the entire hard drive. So I chose to follow this post to reclaim the space left free: https://www.macobserver.com/tips/deep-dive/resize-your-apfs-container/

Note: I have a late 2015 MacBook Pro Retina running High Sierra on it, i.e. the main partition is an APFS container.

I know this is not an exact answer to the question, but I wanted to warn readers of this post of following the procedure without expecting any consequences!

SUGGESTIONS:

  1. It probably was not a good idea to shut down/restart my mac after deleting the partition, because I could not boot again. If you choose to delete the partition, I suggest use diskutil list next to check if your remaining partitions have an unknown type (FFFF...). If so, you're still in live OS and can easily search online for answers.
  2. Maybe resizing via the Terminal after deleting the partition also works.

If anybody else has suggestions on how to delete a partition without running into this problem, I'm sure it would be much appreciated!