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.
- basic technical and terminal knowledge
- Open Disk Utility
File → New Image → Blank Imageor
cmd + N
- Give it a name
- Select a size that will suit your needs (for me 100 mb are more than enough)
- Under encryption select 256-bit-aes and insert a secure password
- Leave everything else as it is
Now you have a
.dmg that needs a password to be mounted
- Open your preferred text editor
- Create a file that has
- 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"
- 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
After executing the .command the terminal window remains open and it can be annoying. Uou can modify this behaviour by:
- Open your terminal.app
- Go to
Preferences → Profiles → <the profile you are using> → shell
When the shell exits:to
Close the window
- Now after executing the .command the terminal window will close
This set-up is MacOS specific but can be easily adjusted to work with other setups and operating systems.