Disk images are one the great things that Mac OS X supports natively. There are so many things that can be done with them like store important data in them securely with the built-in encryption. The encrypted disk images can be taken anywhere and can be opened on any Mac.

All of this can be done through Disk utility, but if you do it repeatedl, creating a little script can save time. For example, in Terminal:

hdiutil create -encryption -stdinpass -srcfolder private encryptedfolder.dmg

So, it would look something like this:

hdiutil create -encryption -stdinpass -srcfolder /Users/Myaccount/Documents encryptedfolder.dmg

Note that the command is entered all in the terminal as one line with a return. This will encrypt the folder to a disk image called encryptedfolder.dmg and bring up a password dialogue box for you to enter a password. If you want to enter the password in the script then try this.

echo -n “password” | hdiutil create -encryption -stdinpass -srcfolder private encrypted.dmg

This will create the disk image with the password of “password” with bringing up an interactive dialogue box. Be warned that anyone with access to the computer may be able to read this script and see you password, but that is not a problem if you take the disk image away from the computer

Related posts:

  1. Create Encrypted Backups with Disk ImagesDisk images make the perfect backup file. Without any extra...