Created
April 18, 2017 12:52
-
-
Save nicdoye/eb159456e7f35abf83a15d948c04f6a1 to your computer and use it in GitHub Desktop.
Unmounting installation disks on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# IMPORTANT ASSUMPTION: | |
# YOU DO NOT HAVE ANY OTHER DISKS MOUNTED WITH AN `s1` PARTITION! | |
# A better way would be to use `diskutil list --plist` and parse the | |
# plist using ruby/python/javascript/your-language-of-choice | |
for disk in $(mount | egrep 'disk.+s1' | awk '{print $1}' | sed -e 's_^/dev/__' -e 's_s1$__') | |
do | |
diskutil eject ${disk} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment