Global keyboard shortcut to eject external hard drive on Mac OSX Lion?

9

5

Is there a global keyboard shortcut to eject an external hard drive? If not, can I install one?

Eddy

Posted 2012-03-27T14:40:04.747

Reputation: 2 897

Answers

14

There is a shortcut in Finder. Select the drive in Finder and press ⌘E, which is the shortcut for File » Eject. This works for any volume (external drives, network shares, disk images).


For a global shortcut, use AppleScript. You don't even need a third party tool for a global shortcut. Open Automator.app, create a new Service, then drag Run AppleScript from the left pane.

Enter the following, and replace the name of your volume appropriately:

tell application "Finder" to eject disk "foo"

Like this:

Save it, then go to System Preferences » Keyboard » Keyboard Shortcuts, and add a global shortcut for your Service.

slhck

Posted 2012-03-27T14:40:04.747

Reputation: 182 472

The desktop counts as a Finder window, so if it's not too much trouble (and you have your external disks show up on your desktop) just click on the icon and hit [⌘] + [E] – intcreator – 2015-08-25T19:24:24.740

Thanks, but I was looking for a global keyboard shortcut so I wouldn't have to click on finder – Eddy – 2012-03-27T16:32:20.427

Next time, please mention that in the question! Updated the answer. – slhck – 2012-03-27T17:01:43.770

4

You can create an Automator service that ejects a specified disk.

  • Start with a Get Specified Finder Items action and drag&drop the volume from the Computer view (Cmd-Shift-C) in Finder to the list.
  • Add an Eject Disk action.

Save as any name, and assign a keyboard shortcut in System Preferences » Keyboard » Keyboard Shortcuts » Services

enter image description here

Daniel Beck

Posted 2012-03-27T14:40:04.747

Reputation: 98 421

1

There are no shortcut key to eject external hard drives but you can write an Automator script to eject your hard drives. There is an "eject disk" action. You can then save your workflow as an application, and then use a utility like Spark to set a keyboard shortcut to launch it.

Jeff Chilton

Posted 2012-03-27T14:40:04.747

Reputation: 251

1That sounds like a lot of work if you could just press ⌘E in Finder. – slhck – 2012-03-27T15:35:56.580

I see "eject disk" in the list of actions in automator. However, I can't figure out to get it to eject the external hard drive – Eddy – 2012-03-27T16:35:49.407

0

If you have a terminal open already, it can be quick to type

$ diskutil list
$ diskutil eject /dev/disk3   # or whatever it is on your machine

Typically, your machine has a certain number of onboard volumes, so the first external disk will have a consistent device name. On my machine, it's /dev/disk3.

poolie

Posted 2012-03-27T14:40:04.747

Reputation: 165