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

    macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #1
    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.

    Steps:

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

    Joined:
    Jul 14, 2011
    #2
    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?

    Alex
     
  3. thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #3

    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 -

    NAME
    drutil -- interact with CD/DVD burners

    SYNOPSIS
    drutil verb [options]

    DESCRIPTION
    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. thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #4
    KR4M works with Lion, ttt.
     
  5. macrumors newbie

    Joined:
    Aug 26, 2011
    #5
    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. macrumors 6502

    Joined:
    Sep 22, 2009
    Location:
    London, Ontario
    #6
    Works perfectly. Thanks for the tutorial!
     
  7. macrumors newbie

    Joined:
    Sep 19, 2011
    #7
    Works perfectly for me too

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

    Joined:
    Oct 22, 2011
    #8
    Exactly what I needed. Thank you!
     
  9. macrumors 68000

    creator2456

    Joined:
    Jul 10, 2007
    Location:
    Chicago
    #9
    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. macrumors 68040

    Joined:
    Jun 27, 2009
    Location:
    Pennsylvania
    #10
    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. macrumors newbie

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

    OS X 10.7.4 (Lion)
     
  12. macrumors 68020

    Joined:
    Feb 28, 2011
    #12
    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. macrumors member

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

    Joined:
    Mar 18, 2012
    #14
    Perfectly Done - Thank you

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

    creator2456

    Joined:
    Jul 10, 2007
    Location:
    Chicago
    #15
    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. macrumors newbie

    Joined:
    Aug 25, 2011
    #16
    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. macrumors member

    Joined:
    Sep 2, 2012
    #17
    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

    macrumors newbie

    Joined:
    Sep 25, 2012
    #18
    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. macrumors 601

    McGiord

    Joined:
    Oct 5, 2003
    Location:
    Dark Castle
    #19
    Worked really nice! Thanks!
     
  20. macrumors newbie

    Joined:
    Sep 21, 2014
    #20
    Thanks. It still works like a charm.
     
  21. macrumors newbie

    Joined:
    Mar 16, 2015
    #21
    Thank you! Still works in OS 10.10
     
  22. macrumors newbie

    Joined:
    Nov 9, 2009
    #22
    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