When an optical disc is mounted in OS X, it cannot be ejected by pressing the button on the optical drive, as is the case with Windows PCs. In fact, even though some of Apple's OEM drives contain the standard eject button, it is hidden by the system's chassis. When mounted, the disc is locked by the system so to eject it you will have to do one of three things:

Drag to the trash
Dragging a removable disc to the trash has been in the Mac OS since early on. It is how floppy disks were ejected when they were prevalently used, and migrated up to being used for optical discs as well.

Select it and press Command-E
If you select the optical disc in the OS X Finder and press Command-E, the disc will eject. This is an evolution to the Command-Y option in the classic Mac OS for "Put Away" that could be used for ejecting among other options in the classic Mac OS.

Eject using the keyboard
The first two options will work for any drive in the system, be it internal or external; however, even though Apple includes an Eject key on its systems, the key will only work for internal drives (if you have two optical drives, holding the Option key when pressing Eject will eject the secondary drive).

If you have an external drive attached to your Mac, then the Eject key will not work; however, there are options for managing external drives using the keyboard. To eject an external optical drive in OS X, just enter the following command in the Terminal:

drutil eject -drive external

You can use Apple's "Automator" tool to create a system service out of the Terminal command (click for larger view).

Entering this command in the Terminal will work, but doing so every time would be a bit cumbersome, so you can set this up as a service that you can then bind to a custom keyboard shortcut for quick access. To do this, do the following procedure:

Open Automator, and create a new "Service" workflow.

At the top of the service, set the "Service Receives" option to "no input" in "any application."

Add the "Run Shell Script" action to the workflow, replacing the default "cat" command with the full command to eject the external drive (above).

Save the workflow and name it something appropriate (e.g., "Eject External Disc").

Go to the "Keyboard Shortcuts" tab in the "Keyboard" system preferences.

In the "Services" section, check the new "Eject External Disc" option and click to the right of the service's name to edit the shortcut for it (you should see an edit field appear).

Type your keyboard shortcut (ensure it is unique--I use Control-Option-Command-E)

Close the system preferences.

With the keyboard shortcut set, now whenever you want to eject a disc in an external optical drive, you can press the keyboard shortcut and the drive should eject. Sometimes applications may not pass the keyboard shortcut to the system services, in which case you can usually get it working by activating the Finder and pressing the shortcut again.

About the author

Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
See full bio