Locally encrypting Obsidian Vault in MacOS

I was looking for a way to locally encrypt my Obsidian Vault in a simple, but secure way.
None of the available solutions where suited for my needs, so I came up with my own solution, heavily inspired by this blog article.

Prerequisites:

  • basic technical and terminal knowledge

Step 1

Creating a encrypted volume

  1. Open Disk Utility
  2. File → New Image → Blank Image or cmd + N
  3. Give it a name
  4. Select a size that will suit your needs (for me 100 mb are more than enough)
  5. Under encryption select 256-bit-aes and insert a secure password
  6. Leave everything else as it is

Now you have a .dmg that needs a password to be mounted

Creating shortcut to mount the encrypted volume and open Obsidian

  1. Open your preferred text editor
  2. Create a file that has .command as extension
  3. Insert the following code and save
#!/bin/bash 

echo 'Mounting the volume'

hdiutil attach ~/Path/to/vault.dmg #has to be full path

echo 'Launching Obsidian...' 

open -a "Obsidian"
  1. Make it executable with chmod +x script.command

When double-clicked, or executed, the script opens a terminal window asking for the password of your vault

Now just select the volume as your vault and Obsidian will remember it (given it is mounted)

Adjustments

After executing the .command the terminal window remains open and it can be annoying. Uou can modify this behaviour by:

  1. Open your terminal.app
  2. Go to Preferences → Profiles → <the profile you are using> → shell
  3. Set When the shell exits: to Close the window
  4. Now after executing the .command the terminal window will close

Other
This set-up is MacOS specific but can be easily adjusted to work with other setups and operating systems.

1 Like

Hi, may I ask how is this secure? Once you mounted the volume it is accessible from /Volumes AFAICS. What you need is encrypted storage that only Obsidian may access (and then a security model for community plugins, but that is not going to happen).