relic shell opens a subshell with your project’s secrets loaded as environment variables. Inside it, bun run dev, npm test, database CLIs, and any other command can read the secrets directly, without a relic run prefix and without a .env file on disk.
Prerequisites
- You are logged in with
relic login - Your project has a
relic.toml(runrelic initat the project root)
Start a shell
$SHELL) with them in its environment. Run your usual commands:
exit (or press Ctrl+D) to return to your original shell. The secrets only existed in the subshell’s environment, so the parent shell never sees them.
The same flags as relic run are available:
How it works
relic shell uses the same authentication, cache, and decryption path as relic run, and starts the shell through the same Rust runner:
- Secret values are decrypted locally and never written to disk.
- On macOS and Linux, the shell starts from a cleared environment with only a small set of system variables (
PATH,HOME,USER,SHELL,TERM, locale,TMPDIR,TZ), plus your secrets. Your shell’s startup files (.zshrc,.bashrc,config.fish) run as usual and restore the rest of your setup. Relic credentials such asRELIC_SERVICE_TOKEN,RELIC_API_KEY, andRELIC_PASSWORDare not passed into the shell. - Variables set outside your startup files, such as
SSH_AUTH_SOCKfrom an SSH agent, are not inherited on macOS and Linux. Export them from your startup file if you need them inside the shell. Or pass--inherit-envto bring your current environment (minusRELIC_*variables) into the shell; secrets win on conflicts. Ctrl+Cinterrupts the command running inside the shell, not the shell itself. The exit code of the shell becomes the exit code ofrelic shell.
If a startup file exports a variable with the same name as one of your secrets, the startup file
wins because it runs after the secrets are loaded.
Show the environment in your prompt
Relic sets these variables inside the shell:
Use them to show which environment is active. Add one of these snippets to the end of your shell configuration:
PROMPT directly, since the framework redraws the prompt after your startup file runs.
Nested shells
Runningrelic shell inside a relic shell is refused, so you don’t lose track of which environment is active:
--force to open a nested shell anyway. On macOS and Linux the nested shell only contains the secrets of the new environment, not the outer one.
Windows
On Windows,relic shell starts $SHELL if it points to an existing executable, and otherwise falls back to %COMSPEC% (usually cmd.exe). As with relic run, the shell starts from a cleared environment that keeps only the Windows system variables listed in Runner; pass --inherit-env to keep your full environment.
When to use relic run instead
relic shell is meant for interactive work on your machine. For scripts, CI/CD pipelines, and one-off commands, use relic run, which scopes secrets to a single process: