What is a "Disk Image"?
In MacOS, you can’t directly lock any folder or file. Instead we create what is called a “Disk Image”, or “.dmg” file using the folder you want to lock. You might have noticed this type of file format when installing software. A disk image file, when opened, acts as a virtual USB drive where you can store files. We will create a disk image file that asks for a password when opened, where we can store our personal data. When we eject this virtual drive, the files will no longer be accessible, unless you click on the disk image file and enter the password to “mount” the virtual USB again. We will be using the built-in app “Disk Utility”.
Step 1: Creating the Disk Image.
First, keep your folder that you want to lock in an easy to find place. For example, my folder “Appleosophy”, is kept on the desktop. Next find the application “Disk Utility” (in spotlight search or in Applications folder in Finder) and open it. On the menu bar, you want to click on “File” -> “New Image” -> “Image from Folder”. In the pop-up, browse and select the folder that you want to protect.
Under “Save As”, you can change the name for your Disk Image file. By default it will match the name of the folder, or you can change it to something like “Private.” I am going to name mine as “Personal.”
Under encryption you have two options: 128-bit and 256-bit. For casual locking 128-bit is sufficient, but if you are serious about 100% security, go with 256-bit. Note that to decrypt and encrypt 256-bit files takes more time, and is not recommended especially if you have large files. Once you select, enter the password you wish to have for your disk image.
Under “Image Format”, we are presented with numerous options, but we are only interested in two: “Compressed” and “Read/Write.” Both yield the same result, but the former gives you a disk image size that is smaller than the actual folder. The only difference is the decryption time, where “Read/Write” option decrypts and encrypts faster than “Compressed.”
Click on “Save”, and it may take time to generate depedning on your folder size.
Step 2: That's it!
Based on what location you selected (desktop for me) your disk image should have appeared in the respective location! Note that the original folder that you used to create your password protected disk image still exists, so you need to move that to trash, and empty the trash to get rid of it.
Try clicking on the disk image we just created, it should ask for your password. After you enter, you should see the disk mounted and opened for access! Note that even after closing the window, the disk will remain mounted until you eject it. After that, just click on the disk image file to enter the password again. You’re all set now! Start protecting the folders you need!
Remember to eject everytime you are done accessing your hidden folder!