Creating An Encrypted Disk Image

How can I create an encrypted disk image, at a predefined location (imageLocation) and with a specified password (thePassword)?

I don’t have code to offer but I reckon you’ll need to use the shell utility named ‘hdiutil’. It can be wrapped in AppleScript by using ‘do shell script’.

– Rob

There are a ton more options such as building from a source folder, adding a background image, auto-mounting, Internet enabling, etc., etc., etc. but this will create a basic encrypted image on your desktop (it will prompt you for a password):


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

That’s great. Thanks. Is there a wat to specify what the contents of the disk image are automatically, or do I have to copy them after it is created. It was said that it is possible to build from a source folder, but can I build from several source folders?

I’m just searching a way to add a background image. Maybe you could help me out? :rolleyes: