I have an external disk with two partitions on it that I keep plugged into my MacBook Pro when I'm at my desk. (One is for Time Machine, the other just for extra storage.) Sometimes I need to grab my laptop quickly and take it somewhere, but I have to change to a space where I can see the partitions on the desktop, lasso them, two-finger click, and select Eject. Is there a faster way under Mavericks, or do I have to set up an AppleScript like this one with a keyboard shortcut?

Note: I'm not looking to eject these only when I put my Mac to sleep (as explored here). Sometimes I'm on a screen-sharing telecon and I have to take my Mac away from my desk for a minute, if you know what I mean :-).

  • I use Alfred.app to do this task. It makes it as easy as pressing <kbd>cmd</kbd>+<kbd>space</kbd> and typing eject. Highly recommended
    – wrossmck
    Commented Aug 28, 2014 at 15:07
  • Lots of good answers below. I'm having a tough time choosing one as the best.
    – Jim L.
    Commented Aug 29, 2014 at 13:58
  • This place ain't big enough for two of us,@JimL. Guess I'll have to go. (sorry I know my comment is irrelevant but I saw his name on another post and thought, "I didn't write that!" Really did a double take.
    – JimLohse
    Commented Jan 16, 2019 at 23:57

13 Answers 13


On OS-X Mountain-Lion, I can option-click one of the "Eject" icons (hold down option, then click the eject icon), and all external partitions will eject.

(Update) This has been verified to also work on OS X Mavericks and even on macOS Sierra, as I suspected it would. It can probably be assumed to work on at least all versions in between (try it out!).

  • This still works under Mavericks.
    – Jim L.
    Commented Aug 29, 2014 at 13:57
  • This turns out to be the most satisfying answer for me. One quick key chord and it's done. No extra software needed. Thanks!
    – Jim L.
    Commented Nov 9, 2014 at 4:50
  • 2
    Seems not to work anymore on El Capitan. Can anyone confirm?
    – Matteo
    Commented Mar 2, 2016 at 13:46
  • 1
    @Matteo Still works for me!
    – Jim L.
    Commented Mar 22, 2016 at 21:50

The only caveat to "quickly ejecting" disks with any reliability is that they will not eject if there are files in use which reside on them. That said, you can force eject disks, but that would not be ideal if files are, in fact, in use.

Easiest way to instantly eject all disks is by invoking an Applescript (could also create a shell script, but Applescript is more easily turned into a one-click application solution).

So go to your Applescript Editor, paste in the following:

tell application "Finder" to eject (every disk whose ejectable is true and local volume is true and free space is not equal to 0)

Enter Code in your Script Editor

and save the script as an application wherever you choose (do NOT use the /tmp folder as illustrated). Add the resulting application to your Dock, and you have a one-click Quick Eject.

Select 'Application' as your file format

Note: the and free space is not equal to 0 portion is so that the script doesn't eject the contents of your CD/DVD drive. Remove that if you would like any inserted disks ejected as well.

  • I've wrapped this in a Ruby script in my answer here... sort of the same thing over again... Commented Nov 12, 2015 at 23:25
  • I've put this Applescript to execute in a service and then created a keyboard shortcut in the System Preferences and it works perfectly.
    – juil
    Commented Mar 12, 2017 at 1:48
  • This is my favorite answer because it uses native MacOS stuff. It however doesn't really address the need to quickly physically disconnect external drives. "I have to take my Mac away from my desk for a minute". So, if script ejects only ejectable drives and some were not ejectable at that time - it'd be great if we were warned before removing the cable and heading to another room!
    – tishma
    Commented Jun 21, 2019 at 18:01

I'd recommend Alfred. It's a quick launching app that includes the feature of ejecting volumes. You can select what kind of targets qualify for the command (network drive, local, etc.).

alfred eject command

When you trigger the shortut, you can select a specific volume to unmount. Or you can type ejectall (this shortcut name is customizable).

  • 1
    Note: you'll need to enable these built-in Alfred commands by going to Alfred Preferences -> System -> Eject and Preferences -> System -> "Eject All" alfredapp.com/help/features/system
    – cody.codes
    Commented Oct 17, 2018 at 21:07

I use launchbar to automate this task. It has a command shortcut to Eject All Ejectable Volumes. It's incredibly fast and if you turn off most of the indexing rules, the memory footprint and CPU usage can be tiny.

It's much more powerful than this one trick, but it does do that trick very well and you'd probably be fine using the free version for that purpose since you'd only be using that one shortcut.


if you happen to have the same setup everytime you want to eject several external disks at once, you could use AppleScript / Automater and make your own keyboard shortcut. There is a detailled description how to do this over here: https://superuser.com/questions/405330/global-keyboard-shortcut-to-eject-external-hard-drive-on-mac-osx-lion


You can use the menu bar app Ejector http://www.macupdate.com/app/mac/12216/ejector to eject all ejectable volumes. The only regrettable part for me is that I can't eject them without logging in.


Personally, I'm using Alfred as suggested in another answer. But here's the Applescript answer, wrapped up in a Ruby script.

#!/usr/bin/env ruby
#eject-all shell script

# Dan Rosenstark 2015-11-12 15:28
# http://porkrind.org/missives/calling-applescript-from-ruby/
def osascript(script)
  system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten

if __FILE__ == $0
  appleScript = "tell application \"Finder\" to eject (every disk whose ejectable is true and local volume is true and free space is not equal to 0)";
  osascript appleScript
  puts "I probably ejected all the disks."

you'll have to put it in your path and make it executable.


The AppleScripts above eject all ejectable disks, sadly this also includes cloud disks such as Box.com/Google Drive etc.

In order to eject only non-cloud disks I tweaked the script slightly to:

tell application "Finder" to eject (every disk whose ejectable is true and local volume is true and format is not unknown format) 

Hope this helps anyone who comes here looking for this.


This can be done elegantly with an automator application and using the Display Notification feature for output. Simply save the following as an application and launch it however you prefer.

enter image description here


I use a combination of AppleScript and an application called Spark. Spark is on Github for Homebrew Casks.

brew install Caskroom/cask/spark

Then I just use an AppleScript to eject the drives and bind it to the shortcut ⌘ E.

enter image description here


For disks with partitions, I've found the following Applescript works best.

tell application "System Events"
  key down option
  tell application "Finder"
    with timeout of 15 seconds -- make sure we stop
      eject (every disk whose ejectable is true)
    end timeout
  end tell
  key up option
end tell

Improving on Ady's answer I noticed his version would include my Time Machine disks.

Example: disk "2022-09-07-113224.backup" of application "Finder"

I don't want to eject these. Adding that owner is not "system" filtered out those disks for me. So I use this to eject instead.

tell application "Finder"
    eject (every disk whose ejectable is true and local volume is true and format is not unknown format and owner is not "system")
end tell

You can test which disks will be ejected in Script Editor by running

tell application "Finder"
    every disk whose ejectable is true and local volume is true and format is not unknown format and owner is not "system"
end tell

There's a longer script answer here that might be more reliable. They filter out TimeMachine disks by inspecting the name. Shortcut to eject all external hard drives but not MobileBackups


On macOS Mojave, you can just simply select both of the drives you want eject and click "CMD+E". This will eject both of your disks without any prompts.

  • 1
    That’s exactly what the original question was looking to avoid!
    – Jim L.
    Commented Aug 21, 2019 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .