Is there a command I can enter in Terminal that will force eject a CD or DVD? One that will always work, equivalent to a "Force Quit" for an app?

I have an intermittent problem getting the DVD in my Mac Pro to eject. Right now the only solution is to do a full restart, but that is obviously not always convenient. I'm hoping there is a workaround to this through the magical power of UNIX...

  • 1
    You should realize that if the OS (OS X) can't eject your DVD tray, the OS (Darwin) will likely be unable to eject your DVD tray. When you get down to it, both are running the same code to communicate with the drive hardware. This question is still useful for remote administrators, but in your case I think you have a hardware issue on your hands. At least it's pretty easy to replace a Mac Pro optical drive.
    – NReilingh
    Feb 8, 2011 at 0:46

1 Answer 1


First of all, try the "nice" way using the drive utility

drutil tray eject

If this doesn´t work (probably because the system can´t unmount the volume), the following command will forcefully unmount the Volume with name "untitled" (make sure you´re using the right mountpoint!!):

hdiutil detach -force /Volumes/untitled
  • drutil just hangs. What is the volume name if there is no CD in the drive? Feb 7, 2011 at 19:32
  • 2
    What do you mean exactly with "no CD in the drive"? Do you have no physical medium in your drive or does it just not show up in your computer? Anyway you can run "diskutil -list" to get the identifiers for Volumes and use them instead of /Volumes/mountpoint; disk0 usually indicates your main drive, so the above command would change to eg. hdiutil detach -force disk2 if disk2 turns out to be the Identifier for an empty CD/DVD
    – Asmus
    Feb 7, 2011 at 20:37
  • Perfect! This has been a common problem for me since I use a mac over VNC with now eject button. For whatever reason the CD/DVD images don't show up anywhere on the desktop, so I can't drag/drop into the trash either. drutil tray eject works perfect! Nov 1, 2013 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .