The bge command-line tool is the terminal companion to the DotBGE
apps. It writes the open .bge format — RSA-4096-OAEP for sealing a
file to a person, AES-256-GCM for the contents — with no servers, no accounts, and
nothing to lock you in. .bge files and .bgekey identity
cards round-trip with the apps for iPhone, iPad, and Mac.
Install
brew install --cask dotbge/tap/bge
The macOS build is a universal binary (Apple Silicon and Intel), signed with
an Apple Developer ID and notarized, so it runs without Gatekeeper warnings. You can
also download a .pkg or the standalone .zip from the
releases page.
Linux (x86_64 or aarch64)
# download the tarball for your arch from the releases page, then:
tar xzf bge-<version>-linux-x86_64.tar.gz
sudo install bge-<version>-linux-x86_64/bge /usr/local/bin/bge
bge --version
The Linux binaries statically link the Swift runtime, so they run on any recent glibc-based distribution — no Swift install required.
Verify a download: shasum -a 256 -c SHA256SUMS (macOS)
· sha256sum -c SHA256SUMS-linux (Linux).
Quick start
# 1. Make an identity key pair bge keygen -o alice # → alice.pem (private) + alice.pub.pem # 2. Encrypt for someone — only their private key can open it bge encrypt report.pdf -r alice.pub.pem # → report.pdf.bge # 3. Decrypt with your private key bge decrypt report.pdf.bge -k alice.pem # → report.pdf
Run bge -h, or bge <command> -h, for every option.
enc / dec are aliases for encrypt /
decrypt.
How do I…?
The most common tasks, each as a one-liner. bge never overwrites by
default — add -f only when you mean to.
You need their public key — a .pem, a
.bgekey card, or a saved contact name. Only their private key can open
the result.
bge encrypt report.pdf -r alice.pub.pem # → report.pdf.bge
Save their key once, then encrypt by name. The address book lives in
~/.bge and holds public keys only.
bge contact add alice.pub.pem -n Alice
bge encrypt report.pdf -r Alice # name is case-insensitive
With no recipient, bge seals the file to your own active
identity — only your private key opens it.
bge identity add me.pub.pem -n Me # once bge encrypt taxes.pdf # → sealed to you
Good when you can't exchange keys ahead of time — anyone with the passphrase can open it.
bge encrypt report.pdf -p # prompts for a passphrase
bge decrypt report.pdf.bge -k alice.pem # identity → report.pdf bge decrypt report.pdf.bge -p # password file → prompts
Keyless — reads only the public header. If the recipient is in your
address book, it also prints Encrypted for: <name>.
bge inspect report.pdf.bge # mode, key ID, size — no key needed
Mirror the tree (browse files individually) or pack it into one archive that also hides the file names.
bge encrypt myfolder -r Alice # → myfolder_bge/ (one .bge per file) bge encrypt myfolder -a -r Alice # → myfolder.zip.bge (one archive)
Pass them with -a — bge zips and encrypts them
for you; no temp folder needed.
bge encrypt a.pdf notes.txt photo.jpg -a -r Alice -o bundle.bge
bge decrypt bundle.bge -k alice.pem -x # decrypt + unzip
Pipe through stdin/stdout with -. Status goes to stderr, so
stdout carries only data.
bge decrypt - -k alice.pem < archive.tgz.bge | tar xzf -
Prefer RSA keys (no prompt). For password mode, pipe the passphrase with
--password-stdin — never put a secret on the command line.
printf %s "$PASSPHRASE" | bge encrypt notes.txt --password-stdin
Branch on the sysexits
exit codes: 64 usage · 65 data · 66 no input
· 77 can't decrypt.
Wrap your public key into a .bgekey card the DotBGE apps
import as a contact. No private key is read.
bge card alice.pub.pem -n "Alice" # → Alice.bgekey
Let an agent do the encrypting
The repository ships a Claude Code
skill so you can just ask — “encrypt report.pdf for Alice”,
“decrypt this and summarise it” — and the agent runs bge
safely, with no plaintext left lying around.
See bge for Claude Code & AI agents → — the scenarios it handles, the guardrails, and how to install the skill.
An open format, not a silo
The CLI uses file-based keys only and never stores private keys. It writes the same open .bge v3 container the apps do — documented, with test vectors, so your files outlive any single tool.