I can't undo a partition on my macbook

Solution 1:

For anyone saying not to delete it because it's the EFI partition, it's not. "EFI EFI"(disk0s1) is the real EFI partition. The new EFI partition is just one that was improperly created during OP's failed installation of Ubuntu.

This will erase the partition and make it show up in Disk Utility(change PartitionName to whatever you want):

sudo diskutil eraseVolume JHFS+ PartitionName disk0s4

Now you can remove the partition like normal in Disk Utility(source):

  1. Open Disk Utility.
  2. Click the partition that you wish to delete under the logical volume.
  3. Click the Erase tab and make sure Mac OS X Extended (Journaled) is selected.
  4. Click the Erase button.
  5. Click the logical volume.
  6. Click the Partition tab.
  7. Highlight the partition that you erased in step 4.
  8. Click the ‘-‘ sign and click Remove.
  9. Use the drag handle to reallocate the space back relinquished by the deleted partition.
  10. Click Apply → Partition.