Mount a dmg programmatically

Hello,

I have an encrypted dmg file containing a secret file. When a user want's to see the secret, he must mount the dmg and provide password.

When the dmg is mounted, every user connected to the computer can see the secret file ! And i don't want this.

Is there a way to open a dmg file with swift language, without mounting it ?

Thanks

Is there a way to open a dmg file with swift language, without mounting it ?

No.

Well, there’s no supported way to do this. The disk image format (.dmg) is not documented for public use.

One option here is to mount the disk image with the MNT_DONTBROWSE flag set, by passing in the -nobrowse argument to hdiutil. This prevents it from showing up in the UI. Other users can still access it, they just can’t see it in Finder.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Mount a dmg programmatically
 
 
Q