Scott Whittaker

Frontend Developer

Day job React | side projects Svelte

Unmount a USB drive from a bash script

Another 30 minutes lost looking for a script on an old machine that shows how to unmount a USB disc from a bash script. I have no idea where I found the answer originally but this is one solution.

#!/bin/bash

VOLUME='/Volumes/My-USB'

echo 'Ejecting disk...'
diskutil umount $VOLUME