Instantly Eject All Mounted Drives & Disks from Command Line on Mac OS

Check tutorial of Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X

So after a lot of requests from our users here is a guide about Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X.

The next time you’re on the command line and need to eject every single mounted volume, hard drive, disk, disk image and / or external drive connected to a Mac, you can eject them all at once with a handy osascript command string . This is great if you work in the terminal often and want to pack quickly up a workstation and get out and about, but it’s also very useful for managing Macs remotely over an ssh connection, or adding to a shell script, among other possible applications.

For those unfamiliar with osascript, it is a command line interface to AppleScript that allows you to run AppleScript and OSA language scripts from the terminal. The functionality is pretty simple, you basically just enter a script or instruction that you would otherwise put in the AppleScript Editor, and the whole thing is handled from the terminal instead of having to launch in the GUI app in OS X Let’s use osascript to eject all mounted volumes on a Mac.

Eject all mounted volumes, disks and disk images through Terminal

From the terminal, run the following command string in one line:

osascript -e ‘tell the application “Finder” to eject (any disk whose ejectable value is true)’

As usual with the command line, make sure that the full command syntax is on one line. Unless your terminal window is set very large this will likely happen wrap, that’s okay.

Eject all volumes using the command line in Mac OS X

The moment you press Enter to run the command, volumes are ejected. Disk images and network volumes will immediately go away, while external spinning hard drives will spin up first before ejecting. Nevertheless, even if you have to wait for the turn up for some drives the whole job is very fast and no further interaction is required.

There are certainly other ways to do this, including with the hdiutil and diskutil tools, but the osascript method is probably the fastest as it ejects everything without having to use mount points. If you happen to know of another method to mass eject volumes, perhaps one that is cross-platform compatible, so it would work in both Mac OS X and Linux, let us know in the comments.

Do you find yourself using this often? Consider adding it to your bash_profile with an alias to shorten the length of the command. Simply add something like the following to .bash_profile for this purpose:

alias ejectall = “osascript -e” tell the application “Finder” to eject (any disk whose ejectable value is true) “

This means that you only have to type ‘ejectall’ instead of the entire command string.

This is all a bit advanced, of course, and most Mac users are better off ejecting discs by holding down the eject key, or going through the OS X Finder by locating them in the sidebar, hovering over the name, and hitting the eject button to click button.

Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X Guide is free?

Starting from: Free
This guide is a free model
Free Trial: May be included, please check on the official site, we mentioned above.
The Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X tutorial price is Free or Freemium. This means you can truly enjoy the Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X guide.

The Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X guide gives you an easy-to-use and efficient management and Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X tutorial can be used on Linux, Windows or android devices.

Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X: benefits

  • The Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X tutorial is free .
  • Helps many users follow up with interest in a timely manner.
  • The price of the Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X guide is free.

Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X: FAQ

Tutorial Summary: Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X

In this guide, we told you about Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X; please read all steps so that you understand Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X in case if you need any assistance from us, then contact us.

How this tutorial helping you?

So in this guide, we discuss the Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X, which undoubtedly helps you.

What is actual time in which this method complete?

The time to complete the Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X tutorial is 10+ minutes.

What are the supported Device?

Apple

What are the supported Operating system?

mac OS


Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X Tutorial: final note

For our visitors: If you have any queries regards the Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X, then please ask us through the comment section below or directly contact us.
Education: This guide or tutorial is just for educational purposes.
Misinformation: If you want to correct any misinformation about the guide “Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X”, then kindly contact us.
Want to add an alternate method: If anyone wants to add the more methods to the guide Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X, then kindly contact us.
Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.

Compsmag
Logo