Terminal, an app included with the Mac OS, provides access to Mac’s command line. The fact that the Mac has a command line is often a shock to Mac users and Windows switchers, but when you realize that OS X and macOS are built using Unix components, it makes sense that a command line tool is available. Terminal includes commands for working with attached storage devices, such as an optical drive.

Use Terminal to Eject a Stuck CD or DVD

You can make use of diskutil’s ability to work with optical drives to force any stuck media in your optical drive to be ejected. If your Mac has a single optical drive with a stuck disk, the simple approach will probably work for you.

The Simple Approach to Ejecting a Stuck CD or DVD

When the Simple Approach Doesn’t Work

If the simple approach doesn’t work, or your Mac has both an internal and external optical drive, you may need to do a little more work. To issue the proper form of the eject command, you need to know the physical device name used by the Mac for the optical drive with the stuck disk. For example, if the drive is disk1, the command is

How to Identify the Drive

If it’s not already open, launch Terminal and enter the following Terminal command: A list of all the disks currently attached to your Mac is returned by the diskutil command. The Mac uses identifiers in the following format: diskx, where x is a number. The Mac counts drives starting at 0 and adding 1 for each additional device it finds. Examples of the identifier then are disk0, disk1, disk2, and so on. Under each disk identifier, you’ll see a number of disk segments, corresponding to partitions the base disk has been divided into. You may see entries like this:

An Example

The Apple_Driver_ATAPI is a good way to distinguish which device is the optical drive, as it is only used with Apple’s Super Drive and any third-party CD/DVD devices. The DVD that is stuck in the Mac is disk1. The stuck disk has three partitions on it: disk1s1, disk1s2, and disk1s3. You only need the base name — disk1. After you have the optical drive’s identifier, you’re ready to use Terminal to eject the media from the specific drive.

External DVD Drives

If the stuck media is in an external DVD drive, there is a good chance that it may have an emergency disk eject system. This simple system consists of a small hole usually located just below the DVD drive tray. To eject a stuck DVD, unfold a paper clip and insert the now straight clip into the ejection hole. When you feel the paper clip press against an object, continue to push. The drive tray should start to eject. When the tray is open a small amount, you can pull the tray the rest of the way out.