Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tjb1

macrumors 68000
Original poster
Aug 26, 2010
1,999
0
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.

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.
 
Last edited:

acdold

macrumors newbie
Jul 14, 2011
1
0
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
 

tjb1

macrumors 68000
Original poster
Aug 26, 2010
1,999
0
Pennsylvania, USA
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


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.
 

pryfster

macrumors newbie
Aug 26, 2011
1
0
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.
 

boki108

macrumors newbie
Sep 19, 2011
1
0
Works perfectly for me too

Thanks!!!
2009 iMac with broken superdrive and a new External LG Slim DVD drive
 

terraphantm

macrumors 68040
Jun 27, 2009
3,814
663
Pennsylvania
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)

----------

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.

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.
 

Ccrew

macrumors 68020
Feb 28, 2011
2,035
3
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.
 

m4tic

macrumors member
Apr 5, 2011
36
0
SoCal
This worked for me, I used this command:
Code:
drutil eject -drive external

I installed the optical drive into a mbp lookalike ebay enclosure.
 

greenvomit8

macrumors newbie
Mar 18, 2012
15
2
Perfectly Done - Thank you

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

creator2456

macrumors 68000
Jul 10, 2007
1,649
2
Chicago
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.
 

edwarda909

macrumors newbie
Aug 25, 2011
2
0
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
 

hemmick reef

macrumors member
Sep 2, 2012
33
0
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?
 

Broadbent

macrumors newbie
Sep 25, 2012
9
0
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
 
Last edited:

davidknapp

macrumors newbie
Nov 9, 2009
2
0
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"

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.