

If you happen to know of another method to mass eject volumes, perhaps one that is cross platform compatible so that it’d work in Mac OS X as well as linux, do let us know in the comments. There are certainly other ways to do this, including with the hdiutil and diskutil tools, but the osascript method is probably the fastest since it ejects everything without having to use mount points. Nonetheless, even if you have to wait for the spin up of some drives the entire task is very fast and there is no further interaction required. If your drive was working normally and the ejection. Preventing computer and drive from sleep. Disk images and network volumes go immediately, while external spinning hard drives will spin up first before ejecting. In Finder, click the Eject button next to the external drive. The moment you hit the enter key to run the command, volumes will start ejecting. Unless your terminal window is set very large it will likely wrap, that’s ok. Osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)'Īs usual with the command line, be sure the entire command syntax is on one line. Any help would be appreciated, as this is bothering me. Basically I want to switch (if possible) from it ejecting internal disc drive to controlling my external. Ejecting All Mounted Volumes, Drives, and Disk Images via Terminalįrom the Terminal, run the following command string on a single line: So I have a Mac Pro 3,1 (Early 2008) and decided to use an external disc drive for convenience, but I have a problem: Keyboard eject button does not control it.

#Usb eject button for mac how to
How to Use the Function Keys To use the codes that are shown on the front facing side of the keys such as F1 to F12, PgUp (Page Up), Caps, and arrows (cursor), hold down the Fn key and press the relevant key. Do this to choose volumes, folders or files you do NOT want to backup. You can set its options by clicking the Options button. Make sure the Time Machine switch is set to ON. In the dialog box that appears, select the G-DRIVE mobile USB. Let’s use osascript to eject all the mounted volumes on a Mac. this happens, disconnect the USB cable from the keyboard’s Mini-USB port and reconnect it. Using Your Drive on Mac ® G DRIVE ® USB Using Your Drive on Mac ® 3. The functionality is quite simple, you basically just feed it a script or statement that you’d otherwise place into the AppleScript Editor, and the whole thing is handled from the terminal rather than having to launch into the GUI app within OS X. For those who are unfamiliar with osascript, it’s a command line interface to AppleScript that allows you to execute AppleScripts and OSA language scripts from the terminal.
