EnvLatch CLI
EnvLatch keeps API keys in the macOS Keychain and gives a command only the environment variables you pick, with no .env files
- 99 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- Stores API keys and tokens and injects them into processes: any launched program sees the selected values
- The broad launch envlatch run -- command without --using exposes every saved key to the program
Install
- Works in
Manual install
git clone https://github.com/Raylinkh/envlatch.git && cd envlatch && ./scripts/install.shNeeds macOS 13+ and Xcode 16 or Swift 6. The installer builds EnvLatch.app into ~/Applications, installs ~/.local/bin/envlatch and the skill into ~/.agents/skills/envlatch with links for Codex, Claude Code and Gemini CLI.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Stores API keys and tokens and injects them into processes: any launched program sees the selected values
- The broad launch envlatch run -- command without --using exposes every saved key to the program
This is third-party code. Review the repository files before installing.
What it does
EnvLatch is a native macOS 13+ app with an envlatch command. Keys such as OPENAI_API_KEY, ANTHROPIC_API_KEY or GITHUB_TOKEN live in the regular Keychain and never sync. envlatch run --using ANTHROPIC_API_KEY -- claude starts the program with that variable set, so code and SDKs read it as if it came from .env. Several keys are picked by repeating --using, and a standing set is saved as a group with envlatch groups create. A key can carry endpoint metadata: the API contract (Anthropic, OpenAI Chat Completions, OpenAI Responses, Gemini), an HTTPS base URL and the variable name the client expects. That is how MINIMAX_API_KEY reaches an Anthropic client as ANTHROPIC_AUTH_TOKEN together with ANTHROPIC_BASE_URL. Before reading any value, EnvLatch validates the whole selection and rejects duplicates, missing keys and conflicting bindings. A bundled skill teaches the agent to look only at key and group names (envlatch list, envlatch groups, envlatch doctor) and to wrap its normal command in envlatch run. The program has no command to reveal a value, copy it to the clipboard, export it or eval it.
Who it is for. macOS developers who run Claude Code, Codex or scripts with several API keys and are tired of copying .env files between projects.
Good fit when
- One OpenAI key is needed in five projects and should live in a single place
- An agent runs tests that need only OPENAI_API_KEY and GITHUB_TOKEN and should not see the other keys
- A client with an Anthropic-compatible API receives another provider's key through envlatch run and an endpoint binding
- Keys must stay out of terminal history, shell profiles and the repository
Not a fit when
- You need protection from a malicious agent or dependency: the launched process sees every selected variable and there is no sandbox
- You work on Linux or Windows: the app builds only for macOS 13 and newer
- You need the keys on several machines: there is no sync or server side
- Your team uses a shared secret manager such as 1Password or Vault: EnvLatch does not replace it
Example request
Install EnvLatch, run the project tests through envlatch run with OPENAI_API_KEY and GITHUB_TOKEN and never show the key valuesLimitations
- Environment injection does not isolate a secret: the launched process and its descendants read every selected value, and crashes or debug tools may expose process memory. The author recommends scoped keys and provider-side spending limits.
- Installation builds the app from source (macOS 13+ and Xcode 16 or a Swift 6 toolchain). Builds are ad-hoc signed, so after a rebuild macOS may ask for Keychain access again.
- EnvLatch keeps the inherited environment: keys already exported by the parent shell are not scrubbed.
- Inside an agent sandbox saved_key_count can show zero although keys exist. Run the command through the host's normal approval path with Keychain access.
How to disable. Delete the app from ~/Applications and the ~/.local/bin/envlatch symlink, then the skill at ~/.agents/skills/envlatch along with the links for Codex, Claude Code and Gemini CLI. Saved keys stay in the macOS Keychain and can be removed in Keychain Access.
FAQ
How do I start Claude Code with a key from the macOS Keychain?
Run envlatch run --using ANTHROPIC_API_KEY -- claude. The claude program starts with ANTHROPIC_API_KEY set, and the key never appears in .env or a shell profile.
Can an agent read a key value through EnvLatch?
Not directly: EnvLatch has no reveal, copy, export or eval command, and the skill forbids the agent to print values. The launched program does read the selected variables, so use narrowly scoped keys.
How do I give a program several keys at once?
Repeat --using for each key or save the set with envlatch groups create "Backend" --using OPENAI_API_KEY --using GITHUB_TOKEN and launch envlatch run --using "Backend". A group cannot be mixed with separate keys in one launch.
Does EnvLatch work with Cursor or Cline?
The installer links the skill for Codex, Claude Code and Gemini CLI, and that is only a convenience: there is no allowlist. Any other agent can read the skill from ~/.agents/skills/envlatch and call `envlatch run`.
What does envlatch doctor do?
It reports how many keys the current process can see and the install state. If the host sandbox hides the Keychain, it exits with a keychain_visibility_warning error, and the command should be re-run with Keychain access.
Discussion
No questions or reviews yet.
Related
CLI toolsThe elbab CLI keeps keys and passwords encrypted and lets an agent run commands with secrets without ever showing them.
A skill and CLI around .env.schema: the agent sees variable names, types and rules while secret values never reach its context
Vahta lets an agent use your passwords and API keys from an encrypted vault without ever showing it the values
Lade hands a command secrets and private-network access only while it runs, then removes it, for humans and agents alike
dotenvx is an environment-variable CLI that encrypts project configuration; the application needs a decryption key to load it.
A CLI and MCP bridge over a KeePass-compatible vault: an agent gets one secret only after your answer, and every request lands in a log
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| EnvLatch (this card) | no | 99 | |
| agent-secrets | no | 114 | lends secrets to an agent for a limited time with age encryption and an access log |
| dotenvx | no | 5,880 | encrypts .env configuration, with values released only to an app holding the key |
README in short
The repository holds a SwiftUI app, the envlatch command and a portable skill. The README covers installing from source, saving keys in the GUI, launching with envlatch run, groups and endpoint metadata. A separate section states the security boundary: injecting variables guards against accidental leaks into a repository, history and logs, and does not guard against a malicious process.