Quick Tip: Eject Media from Command Line on Mac OS X

Ever needed to eject a disc, cd, DVD, or media from the command line on a Mac? You can do that from the Terminal, as we’ll show here.

To eject a disc or media from the command line on Mac, open up your Terminal and type the following: drutil tray open

or you can type to eject directly if you do not have a tray-operated superdrive or disc reader

drutil eject

Both of those commands should work to eject whatever media is stubbornly staying in the drive (unless of course the drive is damaged).

If you’re feeling cheeky and wanted to play a prank on someone, using those commands you could ssh into their machine and eject whatever media is in their drive, but that would be mean. On a more serious note, using the command line does offer remote ejection of media, which can be very helpful.

Perhaps you’ve run into the following problem: some inserted media (either a CD or DVD disc) refuses to eject itself when you hit the eject key. Often a reboot will fix this problem, but before you try rebooting, try the command line trick above, it just may work as well.

Related

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

This website and third-party tools use cookies for functional, analytical, and advertising purposes. By continuing to browse the site, closing this banner, scrolling this webpage, or clicking a link, you agree to these cookies. You can review our privacy policy for additional information.I AcceptPrivacy Policy