A week or so ago, I was reading about some general automation utility like Better Touch Tool, Alfred, or Raycast, all of which I own. I don’t recall which it was, which is my problem. I saw in what I read that it was possible to set up an automation to MOUNT a USB disk that was currently unmounted, but attached. I cannot for the life of me find anything in any of the half-dozen apps I’ve looked at that tells how to do this. I really need it! I am tired of launching Disk Utility and waiting for it to come fully up before I can mount a disk.
Anyone know what I am talking about?
Maybe you spotted an extension to one of the apps? For example, here is one for Alfred.
With a few terminal commands you can build mounting a volume into any automation with pretty much any automation tool.
For example if you had a particular volume, you could build an automation that toggles whether is is mounted or unmounted based on a keyboard shortcut. All three tools you listed can support running a shell script with a keyboard shortcut trigger.
You can use the shell command diskutil
to list disks and to mount/unmount them.
To unmount is easy,
diskutil unmount "/Volumes/Volume Name"
Mounting is slightly more difficult, you can use the command:
diskutil list
to list them, and then you can find the volumne name in the list, and include the volume type, for example “APFS Volume My Volume” or “Apple_HFS My Volume”.
Then you can use this command to get the disk id of the volume:
diskutil list | grep 'APFS Volume My Volume' | perl -pe 's/.*\b(disk\w+)\b.*/$1/'`
And then you can use diskutil mount
to mount the volume, with the command (togeter with the above) like this:
diskutil mount `diskutil list | grep 'APFS Volume My Volume' | perl -pe 's/.*\b(disk\w+)\b.*/$1/'`
At which point, you can use any automation tool that can run a script to mount or unmount your volumes.