Having a CD or DVD stuck in your Mac or an optical drive isn't a fun situation. And while there are a number of ways to force the media to be ejected, most require you to shut down. If that presents a problem, you can use Terminal to force eject the CD or DVD, without shutting down your Mac.
Terminal, an app included with OS X, provides access to the Mac’s command line. The fact that the Mac has a command line is often times a bit of a shock to Mac users and Windows switchers. But when you realize that OS X is built using Unix components, such as the Mach kernel and portions of BSD (Berkeley Software Distribution), then it makes sense that a command line tool is available.
Perhaps even more important for the problem of a stuck CD or DVD in your optical drive is that Terminal includes a command for working with attached storage devices, such as an optical drive. This command, diskutil, can do quite a bit; in fact, it's the foundation for the Disk Utility app that's also included with the Mac.
continue reading below our video
Quick Tip: Eject a Stuck Disc on a Mac
We're going to make use of diskutil's ability to work with optical drives to force any stuck media in your optical drive to be ejected.
Use Terminal to Eject a Stuck CD or DVD
Launch Terminal, located at /Applications/Utilities.
In the Terminal window, enter one of the following three commands:
If you have a single optical drive:
drutil eject
If you have both an internal and external optical drive, use the appropriate command below, depending on which drive has the stuck CD or DVD:
drutil eject internal
drutil eject external
Press return or enter after entering one of the above commands in Terminal.
The stuck CD or DVD should be ejected.
The above should solve most stuck CD or DVD problems, but there's still another method for ejecting a stuck CD or DVD. In this case, the problem occurs when you have more than one internal or external optical drive. In those conditions, you can use a different command, diskutil, to eject a specific device.
In order to issue the proper form of the eject command, you need to know the physical device name used by OS X for the optical drive that has the stuck disk.
Use Diskutil to Eject a Specific Drive's Media
If it's not already open, launch Terminal, located in the /Applications/Utilities folder.
To find out the optical drive's name, issue the following Terminal command:
diskutil list
diskutil will return a list of all the disks currently attached to your Mac. 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 would be: disk0, disk1, disk2, etc.
Under each disk identifier, you'll also see a number of disk segments, corresponding to partitions the base disk has been divided into. Thus, you may see entries like this:
/dev/disk0 | ||||
| #: | TYPE | NAME | SIZE | IDENTIFIER |
| 0: | GUID_partition_scheme | 500 GB | disk0 | |
| 1: | EFI | EFI | 209.7 MB | disk0s1 |
| 2: | Apple_HFS | Macintosh HD | 499.8 GB | disk0s2 |
| 3: | Apple_Boot_Recovery | Recovery HD | 650 MB | disk0s3 |
/dev/disk1 | ||||
| #: | TYPE | NAME | SIZE | IDENTIFIER |
| 0: | Apple_partition_scheme | 7.8 GB | disk1 | |
| 1: | Apple_partition_map | 30.7 KB | disk1s1 | |
| 2: | Apple_Driver_ATAPI | 1 GB | disk1s2 | |
| 3: | Apple_HFS | Mac OS X Install | 6.7 GB | disk1s3 |
In the above example there are two physical disks (disk0 and disk1), each containing additional partitions. To locate the devices corresponding to your optical drives, find the entries that have a type name of Apple_Driver_ATAPI. Read across to find the identifier, then use just the base name of the identifier in the diskutil eject command.
As an example:
The DVD that is stuck in the Mac shows up as disk1s3. The stuck disk actually has three partitions on it: disk1s1, disk1s2, and disk1s3. 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.
Once you have the optical drive's identifier, in our example disk1, you're ready to use Terminal to eject the media from the specific drive.
At the Terminal prompt enter:
diskutil eject disk1
Press enter or return.
Remember to change the identifier in the above example to match the identifier you found using the diskutil list command.
You can quit Terminal.
If you're still not able to eject the optical drive’s media, you may have to resort to using one the methods outlined in: How do I eject a CD or DVD from my Mac?
