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

encryptionfoldersmacos

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 😛

Best Answer

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 File → New → Disk 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