I have an encrypted, password-protected sparsebundle that I occasionally mount and unmount from the terminal. I want the system to ask for the password every time I mount it, but for some reason it keeps remembering.

This is how I mount it: hdiutil attach ~/path/to/my/bundle -mountpoint ~/my/mountpoint

These are some of the ways I've tried to unmount it:

hdiutil detach -force ~/path/to/my/bundle
hdiutil detach -force /Users/me/path/to/my/bundle
hdiutil eject -force ~/path/to/my/bundle
diskutil eject ~/path/to/my/bundle
diskutil unmount force ~/path/to/my/bundle

(I've read here that hdiutil unmount is not sufficient to make the system forget the password.)

However, whatever I try, the system "helpfully" remembers the password each time.

Only when I use the eject button in Finder, does the system forget the password.

EDIT: Also, there is no entry in my keychain that suggest the password has been cached. (At least, I can't find it. There are none with kind disk image password.)

What am I missing here? How can I make sure the sytem always asks for the password, each time I mount the sparsebundle?

EDIT 2: I've created a new sparsebundle, with a new name and a different password, but the problem persists.

2 Answers 2


Your password is probably stored in your Keychain. Remove that entry and you will be forced to enter the password every time.

  • I've looked there but I couldn't find it. What name could it have?
    – jqno
    Oct 29, 2018 at 15:53
  • Sort by Kind and look for disk image password. I just did and only had one such entry. It was called imagename.sparsebundle
    – d-b
    Oct 30, 2018 at 8:54
  • Alas, no disk image password in there...
    – jqno
    Oct 30, 2018 at 9:44

It feels kind of sad, but in the end I managed to find a way to do it using AppleScript:

osascript -e 'tell application "Finder" to eject "<name>"'

The <name> should match the name in Finder's sidebar.

You must log in to answer this question.

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