macrun
macrun is a macOS command-line tool for local development secrets.
It stores secret values in macOS Keychain, tracks non-secret metadata separately, and injects secrets into a child process only when you explicitly run a command.
If you want the convenience of environment variables without leaving plaintext .env files around your repo, this is the tool.
Why Use It
Local secret handling tends to drift into one of a few bad patterns:
- large plaintext
.envfiles copied between projects - long-lived
exportcommands in a shell session - reusing the wrong project's credentials by accident
- handing every secret to every process whether it needs them or not
macrun is designed to tighten that up without trying to be a full secret platform.
It helps by:
- storing secret values in Keychain instead of repo files
- scoping secrets by project and profile
- importing from existing
.envfiles when needed - supporting selective injection with
--onlyand--prefix - keeping the main workflow centered on
macrun exec -- ...
What It Is Not
macrun is for local development on macOS. It is not a replacement for:
- Vault or another server-side secret manager
- CI/CD secret distribution
- production secret storage
- process sandboxing
If a process receives a secret, that process can still leak it. macrun reduces exposure before process start; it does not make an unsafe program safe.
Install
From crates.io:
From this repository:
During development you can also run it directly:
To install the exact lockfile-resolved dependency set from a published release:
Quick Start
Initialize the current working tree:
Import an existing .env file:
List stored keys without printing values:
Run a command with only the secrets it needs:
Or inject a specific subset:
Mental Model
Each stored secret is identified by:
- project
- profile
- environment variable name
Example scope:
- project:
my-app - profile:
dev - key:
APP_DATABASE_URL
When you run a command, macrun resolves the active project and profile, reads the selected values from Keychain, and injects them only into the child process you launched.
Core Commands
Implemented today:
initsetgetimportlistexecenvunsetpurge --yesdoctorvault push
Global flags:
--project NAME--profile NAME--json
Common Workflows
Set secrets manually:
Read a specific value:
Import only a subset from a larger .env file:
Inspect metadata:
Print a machine-readable environment snapshot:
Remove keys:
Project and Profile Resolution
macrun can resolve the active scope from a local config file named .macrun.toml.
Project resolution order:
- explicit
--project .macrun.tomlin the current directory or nearest ancestor- failure
Profile resolution order:
- explicit
--profile default_profilefrom.macrun.tomldev
That means a typical workflow is:
- run
macrun initonce in a working tree - store or import secrets for that project
- run local commands via
macrun exec
Storage Model
Secret values live in macOS Keychain.
The current Keychain layout uses:
- service:
macrun/<project>/<profile> - account: env var name
Non-secret metadata is stored in the app config directory so macrun can efficiently list entries and track source and update time.
Vault Transit Support
macrun includes an optional Vault transit workflow.
vault push can:
- read a secret from Keychain
- encrypt it using Vault transit
- optionally verify decrypt without printing plaintext
Example:
Security Notes
macrun helps reduce:
- accidental commits of plaintext secret files
- broad shell-session contamination
- wrong-project and wrong-profile reuse
- oversharing secrets to processes that do not need them
It does not protect against:
- malware or a compromised user session
- root or admin compromise of the machine
- a child process that logs or forwards its environment
- terminal capture, clipboard leaks, or screen capture
Documentation
- USER_GUIDE.md for full usage and operational guidance
- TODO.md for implementation notes and future work
Release Workflow
Typical release flow:
What those steps do:
make bumpincrements VERSIONmake distincrements BUILD, builds a release binary, and stages release artifacts indist/cargo publishpublishes the crate so users can install it withcargo install macrun
The staged distribution currently includes:
dist/bin/macrundist/USER_GUIDE.mddist/README.mddist/LICENSE
BUILD is intentionally included in the published crate source because the binary reads both VERSION and BUILD at compile time to produce the custom --version output.
License
GPL-3.0-or-later
Copyright (c) Alexander R. Croft