Is there a way to automatically unmount an encrypted .dmg on iMac when logged out ?

Is there a way to automatically unmount an encrypted .dmg on logout ?

I have a script that will unmount it on lock screen and sleep using Shortcuts and Shortery (a companion to Shortcuts), but can't figure how to unmount it on logout.


Shortery has a Login/Logout trigger but can't seem to get it to work.


Wondered if there is an alternative way to accomplish this?


Thanks


[Re-Titled By Moderator]


iMac (2017 – 2020)

Posted on Apr 20, 2025 9:58 PM

Reply
12 replies

Apr 22, 2025 5:31 AM in response to mrokloricred37

However, if I log out with the .dmg mounted and then log back in the .dmg is mounted.

I wouldn’t expect that behavior, either if not unmounting or if it remounts. Have you contacted Apple to let them know?


I don’t know of any logout hooks that could be used. The only way I could think of would be to create an AppleScript application or shortcut that ejects the drive then logs you out. Us that instead of the logout command.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is there a way to automatically unmount an encrypted .dmg on iMac when logged out ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.