ejectAllVolumes

Eject all mounted volumes from your Mac

Eject All Volumes is a Dashboard widget that will unmount any volume that you are connected to. It will eject USB, Firewire, CD-ROM, DVD, and network mounted volumes. The script will exclude “Macintosh HD” from the unmount action. Volume names that contain spaces are supported (eg. “The Volume Name” or “SEAGATE 1”).


Table of Contents


Issues

I use a Macbook Pro for work. We have a large number of network volumes that I have to connect to on a daily basis. I also connect several USB HD’s to my laptop, most of which are usually split into multiple volumes.

On a daily basis I’ll have to following connected to my computer:

  • MagSave Power Connector
  • DVI Monitor (24″ Cinema Display)
  • Ethernet Cable
  • FireWire 400 Cable (connected to the Cinema Display)
  • USB 2.0 Cable (connected to the Cinema Display)
  • WD External USB 2.0 HD
  • Several Network Volumes

Here is a sample list of volumes that I may be connected to:

There are a lot of times where I’m in a hurry to get somewhere and I unplug all of my cables, thus resulting in this error:

Device Removal Error (Mac)

Or you try to safely eject a volume only to be greated with the following prompt:

Eject Prompt (Mac)


Solution

I wanted to be able to eject all of the mounted volumes safely in one action. This had to work under the following criterias:

  • Safely disconnect mounted network volumes.
  • Safely disconnect mounted external hard drives (USB and FireWire).
  • Handle volume names that containe spaces (eg. “MRM Interactive”).
  • Don’t try to disconnect “Macintosh HD”.
  • Do it all in one action!

If for some reason there is a problem with ejecting a mounted volume, the script will pass a message to terminal. This may occur if you are currently working on a file that lives on the mounted volume. Simply stop and/or close all actions to the mounted volume and run the script again.


Change Log

ejectAllVolumes widget v1.1.0
ejectAllVolumes widget v1.0.1
ejectAllVolumes v1.0.1
ejectAllVolumes v1.0.0


Download

ejectAllVolumes is released under the MIT License.

Script File

Download ejectAllVolumes 1.0.1 (Zip file)
Download ejectAllVolumes 1.0.0 (Zip file)

Dashboard Widget

Eject All Volumes

Download ejectAllVolumes widget 1.1.0 (Zip file)
Download ejectAllVolumes widget 1.0.1 (Zip file)


Use (Only for Script File)

Place the file somewhere on your HD.

From Finder:

  1. Double-click the file to run the script.
  2. A new Terminal window will open.
  3. The script will run.
  4. Once the process is complete it will say “complete” in Terminal
  5. Quit Terminal

From Terminal:

  1. Open Terminal
  2. cd to the location you saved the script.
  3. Type ./ejectAllVolumes
  4. The script will run.
  5. Once the process is complete it will say “complete” in Terminal
  6. Quit Terminal

Double-click the file to run or run the script from Terminal


Temporary Hack for Widget

Some users have stated that they have changed the name of their HD from “Macintosh HD” to something like:

  • MacOS
  • HD

Here is a simple solution to fix this problem until I can get around to creating a preferences panel for the widget:

  1. Download the widget again
  2. Cmd+Click (or Right Click) on the widget and choose: Show Package Contents
  3. Use a text editor (eg TextMate) and open the file: findAllVolumes.sh
  4. Change line 19 from
    • hd="Macintosh HD"
    • to
    • hd="Your HD Name"
  5. Save and reinstall

I hope that this helps everyone!

Date
June 5, 2008
Time
5:46 pm
Category
Tags


  • Pingback: psyrendust » ejectAllVolumes Dashboard Widget v1.1.0()

  • Robert

    The widget doesn’t work for me. I followed the directions (“From Finder”) and it completed as stated but the “Eject” button on the widget does nothing.

  • Mike Reese

    The widget works great unless the volume has spaces in the name.

  • I have renamed my hard disk as “MacOS”. Is there any possibility not to disconnect it by default or shall I rename it “Macintosh HD” ?

  • Michel, I’ve added some instructions on how to fix your problem. Check it out Temporary Hack.

  • Thanks for your Temporary Hack. My main disk, renamed as “Macintosh HD” now do’nt appear in the list of mounted volumes. Great!

    The bad story is that for me too, clicking on the “Eject Selected Volumes” button, does nothing. An idea?