You can use Apple’s Disk Utility to convert a folder into an encrypted disk image—a protected archive that you unlock with a password. Such images are particularly helpful when you’re working on confidential company documents away from the office or when your business card reads: International Person of Mystery. But the truth is that creating encrypted disk images with Disk Utility is cumbersome. Thankfully, with a simple Automator workflow, you can secure documents in an instant. It works like this:
Create the workflow
Launch Automator. In the template chooser, select Application and click Choose. Select the Utilities library and from it drag Set Value of Variable into the workflow area to the right. Now select the Files & Folders library and from its list of actions drag New Disk Image into the workflow area, after Set Value of Variable. Return to the Utilities library and drag Get Value of Variable into the workflow. And finally, return to the Files & Folders library and add Move Finder Items to Trash to the workflow.
In the first action—Set Value of Variable—click on the Variable pop-up menu and in the Variable Options window that appears, enter sourceFolder.
Click Options in the New Disk Image action, and enable the Show this action when the workflow runs option. Configure the Size pop-up menu in this action to read Size Disk Image to fit contents. Enable the Encrypt option. From the When done pop-up menu, choose Unmount and return the image file.
In the Get Value of Variable action, choose sourceFolder from the Variable pop-up menu. Click the Options button and enable the Ignore this action’s input option.
Choose File > Save, and in the sheet that appears, name the application Encrypt Image and save it to the desktop.
Work the workflow
To use your new application workflow, just drag a folder that you’d like to encrypt on top of it. When you do this, a New Disk Image window will appear. Enter a name for your mounted volume in the ‘Volume name’ field. If you like, you can additionally enter a name for the disk image in the ‘Save as’ field. Click Continue, and a password window will appear where you must enter and verify a password for the disk image.
If you leave the Remember password in my keychain option checked, this image will open without prompting you for a password (because its password has been stored in your account’s keychain). If you want to be asked for a password whenever you mount the disk image (as you might if someone else has access to your Mac), then uncheck this option.
The workflow could end here, with your new encrypted archive. But chances are that you don’t want an unencrypted version of the folder on your Mac. That’s where the “variable” actions come in. The first gives Automator a designation for the folder you drag onto the application workflow—sourceFolder, in this case. The Get Value of Variable action tells Automator, “Remember that folder we named sourceFolder? I want the next action to apply to it.” Enabling the Ignore this action’s input option tells the workflow to work the next action’s magic (in this case, throwing out the folder we dragged on top of the workflow) only on the item given the sourceFolder designation. If you don’t enable this option, the workflow will delete both the source folder as well as the encrypted archive.
And that’s it. All you need to do is empty the trash to get rid of the source folder. If you’re going to the trouble of encrypting an archive of this material, you might wish to choose Finder > Secure Empty Trash.
Note, this is an updated version of the workflow. The video that accompanies this story shows the original version, before I updated it to use the Variable actions. It works as well, but this is a more efficient method.
OS X Mountain Lion
Chris has covered technology and media since the latter days of the Reagan Administration. In addition to his journalistic endeavors, he's a professional musician in the San Francisco Bay Area.