Encrypt folder on Mac without dmg file so that the contents can expand in size I want to encrypt some folders on my Mac.

I know there is a way of doing it by making a dmg file, but I also want to keep editing those folders. So I just want to encrypt that folder while being able to add more things in the encrypted folder. You know, it should act as how the password works on a user account, if that makes any sense :P
You can use a sparse bundle which will expand when the contents increases in size.


Enable advanced image options in Disk Utility.

defaults write com.apple.DiskUtility advanced-image-options 1

Open Disk Utility and select File → New → Disk Image from Folder… or press ⌘N.
Select the folder that you want to encrypt and press Image.
Choose sparsebundle as the Image Format, and choose the level of encryption you require.
Choose a password to encrypt the image and click OK.


If, after removing some files from the sparse bundle, you wish to decrease its size, you can compact it:

hdiutil compact /path/to/folder.sparsebundle