Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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...

share|improve this question
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 '11 at 0:46
add comment

1 Answer

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
share|improve this answer
    
drutil just hangs. What is the volume name if there is no CD in the drive? –  mynameistaken Feb 7 '11 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 '11 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! –  Brian Knoblauch Nov 1 '13 at 18:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.