Yes, in fact I have just done it yesterday!
The problem with naively installing Ubuntu on an external drive is that your Mac might not recognize it as bootable, due to its custom implementation of the EFI and UEFI specs.
My directions are for installing Ubuntu 16.04 LTS on a 2014 MacbookPro 13-inch Retina model for a system with EFI; after installation, you should be able to boot an Ubuntu installation on an external drive from your Mac's native EFI software. You should be able to try this on your system without fear of irreversibly altering your primary hard drive and system.
I have followed this (http://courses.cms.caltech.edu/cs171/materials/pdfs/How_to_Dual-Boot_OSX_and_Ubuntu.pdf, mirrored on: https://www.scribd.com/document/324530525/How-to-Dual-Boot-OSX-and-Ubuntu) guide with the following modifications.
Under "What you need:"
Instead of 50 GB free space, you need instead a hard drive that you don't mind wiping. Under certain circumstances you can do it without wiping, but I won't cover that here.
Under "Part 2: Preparing your Mac"
Instead of selecting your internal hard drive, select the drive you want to install Ubuntu to. Reformat the hard drive so that the Format is "OS X Extended (Journaled)" and the Scheme is "GPT Partition Map". The purpose of this is to ensure that your hard drive uses the GPT Partition Map and therefore bootable from EFI.
Next, partition the drive such that you have two partitions, and the first should have the "OS X Extended (Journaled)" filesystem. The first partition should be as small as possible but not less than 200MB.
Under "Part 3: Installing Ubuntu"
These modifications are very important. If not followed, you would be at risk of overwriting data in your primary hard drive.
Before you install Ubuntu, if you weren't able to resize the first partition to be as small as 200MB using OS X's Disk Utility, now is your chance. Launch GParted, identify the location of your external drive (here I assume that it is
/dev/sdd), identify the partition (it should be a HFS+ partition), and resize it down to 200MB or 200MiB. Apply your changes.
After you select "Something else", on that screen,
1. Identify the hard drive you had formatted and partitioned earlier, and the path it is on. I shall assume that it is at
/dev/sdd. Change the "Device for boot loader installation:" to the one at
2. Select the larger partition and delete it. In the free space, perform similar steps as the guide to create an ext4 partition that will be "/", and a swap partition. Make a note of that partition, it should be
Under "Part 4: Making Ubuntu bootable"
/dev/sda should instead read
Back in OS X, You may run
diskutil list to determine where your external disk is mounted, e.g.
/dev/disk2. Also identify your Ubuntu Boot Partition, e.g.
sudo bless --device /dev/disk0sN --setBoot, run
sudo bless --device /dev/disk2s2, without the flag, where
/dev/disk2s2 refers to the path of the Ubuntu Boot Partition as mentioned above.
After everything, when you reboot, hold down the
Option key and in addition to the standard choices, you should see an
EFI Boot choice, which if selected, should chainload to a GRUB menu from the GRUB installed at the Ubuntu Boot Partition, from where you can chainload to the Ubuntu installation.
Side-effects and Caveats
I discovered that after installation, for some reason, GRUB was also installed to the EFI partition on my primary internal drive, and I was able to remove it by mounting that EFI partition from my Ubuntu installation, remove the
/EFI/ubuntu directory, then unmounting the partition, and have no repercussions. But I think that it is benign to leave that directory alone.