Are you always using hard disks and USB keys in your Mac? Getting annoyed with having to go to the Finder, scrolling down in the sidebar, and then ejecting these disks before you can unplug all of these devices to move your computer? Or, maybe you just pull out the USB and let Mac OS X complain at you about how the disk was removed without you ejecting it first?
Try using this AppleScript along with a launcher application like QuickSilver to save time and eject all of your disks with one command! A launcher application is basically a quick way to start up applications – you press a keystroke like “Ctrl-Space” and then begin typing, and QuickSilver will find applications that match what you’ve typed. Ejecting disks is quite literally at your fingertips.
- Open up the AppleScript Editor (it’s in /Applications/Utilities)
- Copy and paste the following code:
try
tell application "Finder"
eject the disks
display dialog "Successfully ejected disks." buttons {"Close"} default button "Close"
end tell
on error
display dialog "Unable to eject all disks." buttons {"Close"} default button "Close"
end try
- AppleScript Editor with the Eject All script.
- Save it into a place you’ll find it later. I used ~/Library/Scripts and called the script “EjectAll.scpt”.
- Compile it!
Now, if you double-click on that script, it’ll automatically eject all of your media and give you a dialog box to let you know when it’s finished.

QuickSilver Catalog Preferences Window
In QuickSilver, I added the ~/Library/Scripts directory to my catalog by opening the QuickSilver Preferences, clicking on Catalog, then going to Scripts in the sidebar. I then ensured that “Scripts (User)” was checked.
Then, you can relaunch QuickSilver, press its hotkey (Ctrl-Space by default), and type “EjectAll” and press enter to run the script. It’ll automatically eject all of your media and then you can pull out all of your plugged-in devices without worry!
Like this:
Like Loading...