Artificial intelligent assistant

eject a disk by path / volume name I'm trying to eject a USB drive, e.g `/Volume/MyPassport` I can do that with hdiutil, e.g `hdiutil eject /dev/disk5`. In that case I need to know the disk name of the target volume. So I'd like to use the volume name instead, something like `hdiutil eject /Volume/MyPassport` Any ideas?

Exactly that works for me on Mac OS X 10.11.


$ hdiutil create -size 128m -fs HFS+ blah
...............................................................................
created: /private/var/tmp/blah.dmg
$ hdiutil mount blah.dmg
/dev/disk1 GUID_partition_scheme
/dev/disk1s1 Apple_HFS /Volumes/untitled
$ df | grep unt
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk1s1 262064 6144 255920 3% 766 31990 2% /Volumes/untitled
$ hdiutil eject /Volumes/untitled
"disk1" unmounted.
"disk1" ejected.
$ df | grep unt
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e6f9dfffb2a18a586b59a2bf42322ced