Skip to content

Instantly share code, notes, and snippets.

@nikolay-n
Last active September 24, 2020 12:34
Show Gist options
  • Save nikolay-n/dda75f1078fc8d51ed443db3f55df52b to your computer and use it in GitHub Desktop.
Save nikolay-n/dda75f1078fc8d51ed443db3f55df52b to your computer and use it in GitHub Desktop.
Perl one-liner to detach all mounted dmg
perl -e '$h="hdiutil";$m=`$h info`;@m=split(/=+/,$m);for(reverse(@m)){/\.dmg$/m and m~/dev/d[\w]+\t[^\t]+\t(/.+)$~m and `$h detach -force "$1"` }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment