How can I unlock an encrypted DMG on login?

Something graphical to hdiutil mount ~/Desktop/secure.dmg

1 Answer 1


Add the disk image to System Preferences→Users & Groups→Login Items.
Put the password in your keychain.
Accept that you've just thrown away part of the value of encrypting the disk image.

There is some remaining value. An intruder can't open the disk image with only your disk or the disk image or a copy thereof to work with. But they can open it if they can get control of your computer while you're logged in.

At the least, disable automatic login, and enable "requires password to wake from sleep or screen saver".

  • Thanks for the answer! I just want a dialog ask for the password if it's not mounted yet ..
    – daisy
    Jan 2, 2015 at 10:27
  • Then just add the disk image to Login Items, but don't put the password in the keychain.
    – ganbustein
    Jan 2, 2015 at 10:34
  • Nice, exactly what I want. The image was also unlocked automatically on logout
    – daisy
    Jan 2, 2015 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .