macOS allows you to protect your folders and files with passwords using a simple disk imaging trick. To do this, simply place the necessary files in an encrypted disk image. Subsequently, this image will work as a password-protected folder – to mount it, you only need to enter a password.
Started from OS X Mountain Lion this feature has slightly improved. Now you can create a new encrypted disk image directly from the desired folder. Although you can also create a clean disk image and then fill it as needed. The disk utility will help us in creating such an image.
Encrypting a Folder in macOS
Note: This feature will allow you to encrypt and password protect only the folder. If you want to encrypt the entire disk, you had better use the FileVault feature.
Let’s start:
- Open the utility Disk Utility, which can be found in Applications -> Utilities;
- Call the “File” menu and select the “New Image” option, then “Image from Folder”;

- Specify the folder you want to encrypt, and then click “Create Image”;
- After that, set the image format to read/write and encrypt to 128-bit AES;
- Enter a strong password and choose “read/write” parameter;
- Click “Save”.

By the way, if you are not going to use your encrypted image as a working folder to which you will add or where you will delete documents from, then you can choose a different image format.
Read more: How to Protect Zip Files in Mac with Password?
As a result of the above steps, an encrypted disk image will be created based on the folder you specified. After that, when you try to mount your encrypted dmg file in Finder, you will have to enter a password. Otherwise, you will not receive access to the contents of this file.

Do not forget to just uncheck the option to remember the password. Otherwise, your password will be stored in the system, and everyone who has access to your account will be able to view the contents of the created encrypted image.
Conclusion
It should be noted that the encrypted image created can be treated as a folder – you can copy, delete or move files from it. And everything you add to it will also be encrypted. When you finish working with the image, just unmount it. Re-accessing it again will require a password.
It’s the best time to ask questions and give us your feedback in comments.