Encrypt folder on Mac without dmg file so that the contents can expand in size

Solution 1:

You can use a sparse bundle which will expand when the contents increases in size.

  1. Enable advanced image options in Disk Utility.

    defaults write com.apple.DiskUtility advanced-image-options 1
    
  2. Open Disk Utility and select FileNewDisk Image from Folder… or press ⌘N.

  3. Select the folder that you want to encrypt and press Image.

  4. Choose sparsebundle as the Image Format, and choose the level of encryption you require.

  5. 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

Solution 2:

SOLVED - When you go into disk utility and go to create a new image file, you must use the second drop down for file type and choose "read/write" instead of "compressed". Then set the encryption and password, create the dmg file. You now have a password protected folder that you can access and paste new files / folders to.