It's been a while since Apple offered Macs with built-in optical drives that could use a CD or DVD. The last models were the 2012 Mac Pro and the mid-year 2012 non-Retina 15-inch MacBook Pro.
How to Remove a CD/DVD from an Apple USB Superdrive
Apple first removed the optical drive from the 2008 MacBook Air, and by the end of 2013, all built-in optical drives had been removed from the Mac lineup. That doesn't mean there's no demand for optical drives or the CDs or DVDs they use, though. As a result, external optical drives remain a popular peripheral for many Mac users.
Whether you have an older Mac with a built-in optical drive or an external drive, you can eject a CD or DVD in several ways.
The Mac, unlike most Windows PCs, does not have an external eject button on its CD/DVD drive. Instead, Apple took advantage of the ability of optical drives to respond to an open or close command sent over the drive's electrical interface. Using the open and close commands, the Mac provides several options for ejecting a CD or DVD.