0

I have created an Automator Service to eject all disks in Mac OS X.

find /dev -name "disk[1-9]" -exec diskutil eject {} \;

This works, but I still receive an error message afterwords:

"The action “Run Shell Script” encountered an error."

Anyone know why this is happening?

  • Nothing wrong with the script as you say, you would need to post a screenshot of the workflow. BTW which version of OS X are you running. – Deesbek Dec 18 '13 at 23:11
  • i'm on mavericks thx – swis24 Dec 19 '13 at 20:42
1

When I run the command, I get errors about files in /dev/fd:

$ find /dev -name "disk[1-9]" -exec diskutil eject {} \;
find: /dev/fd/3: Not a directory
find: /dev/fd/8: Not a directory

You don't need find though:

diskutil eject /dev/disk[1-9];exit 0

exit 0 makes the script exit without an error if /dev/disk[1-9] doesn't match any file.

You might also use a Run AppleScript action like this:

tell app "Finder" to eject disks
|improve this answer|||||
  • thank you, diskutil command works, also found these ways as well: find /dev/disk[1-9] -exec diskutil eject {} \; -OR- find /dev -name disk[1-9] -maxdepth 1 -exec diskutil eject {} \; – swis24 Dec 19 '13 at 20:40
  • also, in this case, 'tell app "Finder" to eject disks' does not work for me since i have some disks mounted i do not want to eject. thx – swis24 Dec 19 '13 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.