How To: Eject External CD/DVD Drive with Eject Button

Discussion in 'MacBook Pro' started by tjb1, Jan 1, 2011.

  1. tjb1, Jan 1, 2011
    Last edited: Jul 21, 2011

    tjb1 macrumors 68000

    Aug 26, 2010
    Pennsylvania, USA
    I have been trying to figure this out ever since I got an optibay and then ended up with a useless button on the keyboard. After hours of frustration and trying different things I have found the way to make the Eject button on the keyboard eject the external cd/dvd drive and not affect any hdd/ssd/flash drives or anything else connected via usb or sata.

    Notice: I am not sure if this will work for Leopard or Tiger, only that the software used does work on those operating systems.

    What you will need:

    KeyRemap4Macbook - Works for Lion, Snow Leopard, Leopard, and Tiger.


    1. Download and install KeyRemap4Macbook. Restart is required for use.

    2. Open System Preferences > KeyRepma4Macbook

    3. Make sure you are on the "Change Key" menu and click in the search bar in KeyRemap4Macbook, not the search for System Preferences.

    4. Type "eject" in the search bar and check the box next to "Eject to Command+Control+Option+Shift+E"

    5. Exit System Preferences and open Automator.

    6. Choose the template "Service" and hit "Choose" at the bottom right.

    7. In the search bar at the top left, type "Run Shell Script"

    8. Drag "Run Shell Script" from the left to the Workflow Area.

    9. At the top above "Run Shell Script" click the arrows next to "Service receives selected text" and pick "no input" at the bottom of the list.

    10. Next delete "cat" from the Shell Script and type this "drutil eject"

    11. While in Automator go File > Save As > Eject

    12. Close Automator and open System Preference > Keyboard > Keyboard Shortcuts

    13. In Keyboard Shortcuts choose Services in the left box.

    14. In the right, scroll down to "General" and you should see "Eject" listed.

    15. Make sure the box beside "Eject" is marked and double click on the right side just to the left of the scroll bar.

    16. This should bring up a textbox, in this box type "Command+Control+Option+Shift+E"

    17. After you do that it should close the box and you will then see the key combination listed beside "Eject"

    18. Close System Preferences and the Eject key should now eject your external cd/dvd drive.

    Note 1: The eject key needs to be held down for a short time, similar to before. It will not work if you just press it like any other key.

    Note 2: There is a slight delay for the service to run, I am not sure if adding "drutil list" before "drutil eject" would fix this or not.

    Note 3: KeyRemap4Macbook takes a little bit to startup on my MBP, your experience may differ.

    Note 4: "Eject to Command+Control+Option+Shift+E" must be selected in KeyRemap4Macbook before you apply the shortcut in Keyboard Shortcuts, if you disable it in KeyRemap4Macbook and renable it you may need to redo the shortcut also.

    Thanks to subsonix for helping me with the Shell Script.
  2. acdold macrumors newbie

    Jul 14, 2011
    How to undo

    Thanks for your efforts. I tried your fix, but unfortunately it's now ejecting both my internal and external drives simultaneously. Any ideas on how to fix this?

  3. tjb1 thread starter macrumors 68000

    Aug 26, 2010
    Pennsylvania, USA

    Did you do the script right? drutil??

    I used drutil because it should only work cd/dvd drives. Diskutil may work but you would have to call the specific drive number and that changes based on my experience with using it and it wouldnt be consistent...

    Here is the terminal listing for drutil -

    drutil -- interact with CD/DVD burners

    drutil verb [options]

    drutil uses the DiscRecording framework to interact with attached burning
    devices. Common verbs include burn, erase, eject, help, info, list,
    status, and tray.

    The rest of the verbs are: bulkerase, cdtext, discinfo, dumpiso, dumpudf,
    filename, getconfig, poll, size, subchannel, trackinfo, and version.
  4. tjb1 thread starter macrumors 68000

    Aug 26, 2010
    Pennsylvania, USA
  5. pryfster macrumors newbie

    Aug 26, 2011
    Thanks for the detailed guide. I'll give that a go.
    I do find it strange though that in windows 7 (bootcamped) the eject button works just fine for external usb dvd without affecting other connected usb hard drives.
    Isn't it funny that Apple saw the need to include support for this in their windows bootcamp drivers but left it out on mac osx side? Especially as they expect a lot of people these days to ditch the internal dvd and replace it with an expensive SSD.
  6. robots3humans0 macrumors 6502

    Sep 22, 2009
    London, Ontario
  7. boki108 macrumors newbie

    Sep 19, 2011
    Works perfectly for me too

    2009 iMac with broken superdrive and a new External LG Slim DVD drive
  8. gtwonder macrumors newbie

    Oct 22, 2011
  9. creator2456 macrumors 68000


    Jul 10, 2007
    Thanks for the detailed walkthrough for this. Very easy to follow and does the job perfectly.

    Something I found useful to go with this hack/mod - Make DVD Player work with external DVD drives

    Working just fine on 10.7.2.
  10. terraphantm macrumors 68040

    Jun 27, 2009
    Thanks for the guide; works great! Is there any way to get that eject graphic to pop up like it does with a mac with an internal drive? (I've got an old Macbook air and am using a generic external drive with it)


    I'm pretty sure that Apple simply went out of their way to make sure that OSX only ejects native drives. In their mind it's probably a feature.
  11. player1024 macrumors newbie

    Jan 8, 2012
    fantastic it works flawlessly :D Thank you! :):)

    OS X 10.7.4 (Lion)
  12. Ccrew macrumors 68020

    Feb 28, 2011
    Just curious, rather than go through all these convolutions, does Option-Media Eject or Option-F12 not work for the external? Maybe I'm just used to it since I have 2 drives in my Mac Pro... and thinking since it's the second drive you're essentially working with with the optibay out.
  13. m4tic macrumors member

    Apr 5, 2011
    This worked for me, I used this command:
    drutil eject -drive external
    I installed the optical drive into a mbp lookalike ebay enclosure.
  14. greenvomit8 macrumors newbie


    Mar 18, 2012
    Perfectly Done - Thank you

    Thanks so much for the incredibly detailed and easy to follow instructions tjb1. Worked Flawlessly. All the best!
  15. creator2456 macrumors 68000


    Jul 10, 2007
    Just ran through the instructions again on 10.8. Working great.

    Now I just need to get DVD Player to recognize the external drive since the old method is not working properly.
  16. edwarda909 macrumors newbie

    Aug 25, 2011
    everything went well until i double clicked next to the checked eject, step 15. a textbox came up but it would not receive any thing i tried to type in. please help
  17. hemmick reef macrumors member

    Sep 2, 2012
    It's a matter of changing the shortcut in Finder from cmdE to Fn eject key... but I don't know how to do that.

    Shouldn't this just work without all this fuss?
  18. Broadbent, May 10, 2013
    Last edited: May 12, 2013

    Broadbent macrumors newbie

    Sep 25, 2012
    now DVD player not recognizing drive

    I replaced my optical drive with a SSD, then put my Mac Superdrive in external case. I wanted my eject button to work on the drive, so I followed these instructions, and tried using a DVD. Now DVD player now does not recognize my external drive as a valid Drive? It seemed to have worked before I did this.
    Any Suggestions? I found a thread on getting DVD player to recognize external drives, but it said it doesn't wrk on 10.8

    I was also hoping eventually to plug this drive into an airport extreme and use it through that, would the eject button still work using this method?

    Anyone have the answers?

    MBP 10.8.3 mid 2012 i7 2.9GHZ 8GB RAM, crucial 240GB SSD in optical Drive. 1TB Seagate SSHD
  19. McGiord macrumors 601


    Oct 5, 2003
    Dark Castle
  20. guildmaster macrumors newbie

    Sep 21, 2014
  21. Honky Don macrumors newbie

    Mar 16, 2015
  22. davidknapp macrumors newbie

    Nov 9, 2009
    Update on OSX Yosemite: the new version of the App is named Karabiner and there is an option to "use eject key to eject disk in external drive"


Share This Page