I recently had a need to create a password protected folder on my Mac. Did a little digging and found DiskUtility to be the answer.
- Open DiskUtility at ~/Applications/Utilities/Disk Utility
- File > New > Disk Image From Folder
- Select a folder and click the Image button
- Image Format -> read/write (if you want to be able to modify the contents)
- Encryption -> 128-bit AES
- Enter and confirm password
- Password protected folder is created
This was great. My encrypted folder is now mounted at /Volumes/name_of_folder when I open the *.dmg file. Except that I needed to add files to the folder periodically and the disk image I had created was bound by the original size, give or take a few bytes.
So start over. Did a little more digging and found sparse images. Sparse Image
- Open DiskUtility at ~/Applications/Utilities/Disk Utility
- Click New Image icon, making sure that nothing is selected on the left hand side
- Enter a name in the Save As field. This will be the filename of the sparseimage file
- Enter a name in the Name field. This is the name of the disk image that will be opened
- Choose a maximum size for the disk image
- Choose 128-bit AES encyrption
- Choose sparse disk image under Image format
- Confirm password
- Create your sparseimage file
Done. Now click on the *.sparseimage and your disk image is mounted as /Volumes/name_of_disk_image. Add, delete and modify to your heart’s content.