Force eject a CD in macOS

I recently bought an Apple USB SuperDrive and the disk got stuck. The drive doesn’t have an eject button, and neither does my MacBook. I found I had to run the following in the terminal, to force-eject the CD:

drutil tray eject