Eject all disks with a key press

Posted this to Keyboard Maestro’s forums but in the end, it didn’t use KM, so maybe more useful here.

I want to eject all disks so I can grab my laptop and go. Surprisingly difficult (at least, for me) but I found a way I wanted to share.

I know there’s an AppleScript but as far as I can tell, it can eject a named disk but not eject all.

MacSparky suggested an excellent menu bar app, EjectBar ($2) and it works great but I can only activate it by clicking—it does not offer a hot key. I tried to create a KM macro but just opening the EjectBar app does nothing and I do not know how to make KM click the menu bar icon (which could be anywhere).

However, I also have Bartender and it allows a hotkey to trigger a menubar item, with modifier key if desired. Aha! That makes it easy because EjectBar ejects all disks if you trigger it with a right click.

Must be a better way, but this is what finally worked for me.

1 Like

I’ve been using


Works well for me. It can be set to automatically eject disks when you suspend your device manually or by closing the lid. It makes a beep when done so you know you can unplug. You can also assign a short key to eject all disks and/or suspend.


I used to use Jettison, but then I got Alfred which means it’s a keyboard action. Cmd-Space (opens Alfred for me, not Spotlight), then four keys… e j ↑ enter


Same here, but with Raycast: I have an alias set up, so I type Ctl+Space (to activate Raycast), j + return.

It is possible via AppleScript. I have found such Automator service somewhere on the internet (I wish I remembered where so that I could credit the author; I am not an expert in AppleScript by any measure). Regardless, here’s the code:

-- Defines a handler which tells Finder to eject all disks.
to ejectAllDisk()
		tell application "Finder"
			-- Prevent unmounting full disks, those are in general mounted backup snapshots etc.
			eject (every disk whose ejectable is true and free space is not equal to 0)
		end tell
		-- Display a system notification
		display notification "You can remove your disk safely" with title "Eject all disks" subtitle "Completed"
	on error
		display notification "Failed to eject all disks" with title "Eject all disks" subtitle "Failure"
	end try
end ejectAllDisk

-- this is the main entrance method.
on run
		-- If the eject process takes longer than 3 seconds, tell the user that the operation is still in progress
		with timeout of 15 seconds
		end timeout
	on error
		display notification "Eject is still in progress" with title "Eject all disks" subtitle "Timeout"
		-- Tell finder to eject again. This enables a success notification if the eject fails or succeeds 
	end try
end run

The only thing I changed is duration before timeout as I sometimes use spinning drives and those sometimes take a while to eject.

Same setup but with LaunchBar. I can even cut out a keystroke since after learning it’s put Eject All as the default result for e j :wink:

1 Like

I also use the Eject All command built into Alfred. I think I usually end up typing the whole word, but it’s not a big deal!

1 Like

My drives are visible on my desktop so I just Left Click, select them all with the mouse/trackpad, then Right Click and Eject.