How can I encrypt my VirtualBox VM?

Is there a way for me to use a virtual machine (VirtualBox) on my MacBook Air with encryption protection? I want to install a VM of Ubuntu, and if my employer calls back the hardware I don't want them to be able to access what's on there…


Yes. You can put the VM in an encrypted sparse bundle. This way, the virtual machine can only be run if the image is mounted, and that requires a password.

  1. Open Disk Utility (found in /Applications/Utilities/).

  2. Select FileNewDisk Image from Folder… or press ⌘ cmd+⇧ shift+N.

  3. Select the folder that contains your virtual machine 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. Make sure to uncheck the Remember password in my Keychain box if you believe that they could access your Keychain.

  6. Click OK. Disk Utility will create a sparse bundle to hold the VM.

    The sparse bundle should auto-mount (and request for your password if you didn't store it in your Keychain) when you try to perform any action that would require access to your VM.


While grgarside's procedure is spot on, you may not see sparsebundle as an available Image Format, as can be seen in here... (as i recently experienced)

enter image description here

In this case, it is likely that you will need to enable Disk Utility's advanced image options via the following terminal command.

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

Upon retrying grgarside's procedure, you will see more format options be made available, including the desired sparsebundle.

enter image description here


VirtualBox 5 now has the ability to encrypt VMs directly, so maybe the sparsebundle approach is moot in the narrow case, but still very reasonable in the widest cases.