Unremovable partition after trying to install ubuntu I tried to install Ubuntu on my MacbookPro (mid 2015, OS X Yosemite) dual boot, using the following: How to Dual-Boot OS X and Ubuntu (PDF)

I was finishing up part 3 and Ubuntu was starting to download, until everything froze. Nothing was responding so I force shutdown my computer and now OS X seems to be working fine. However I have a partition disk0s3 (Linux Swap) and a bunch of Free Space I can't get rid of.

/dev/disk0
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *251.0 GB   disk0
1:                        EFI EFI                     209.7 MB   disk0s1
2:                  Apple_HFS Macintosh HD            182.6 GB   disk0s2
3:                 Linux Swap                         16.4 GB    disk0s3


I tried getting rid of them through Internet Recovery but that didn't work either. How can I get rid of the partition and the Free Space?
If you are using El Capitan (OS X 10.11), then the document you are referencing will not work as expected.

As for your question. The command below will remove the Linux Swap partition.

sudo diskutil erasevolume "Free Space" "" /dev/disk0s3


The next command expands your Macintosh HD volume to contain the free space.

sudo diskutil resizevolume /dev/disk0s2 R



  Note: I am not sure if the prefix sudo is necessary. (But, it will do no harm if you include the sudo)