Direnv Environment Manager

Direnv Environment Manager

direnv.net

1

About this website

Direnv is a shell extension that augments existing shells with the ability to load and unload environment variables depending on the current working directory, solving the common problem of managing project-specific configurations. Before each prompt, the tool checks for the existence of a .envrc file in the current and parent directories, evaluates it in a bash sub-shell, captures the environment diff, and applies it to the current shell session. When the user leaves the directory, the variables are automatically unloaded. This approach is far cleaner than manually editing the .profile or .bashrc files with conditional logic. The tool supports all major shells including bash, zsh, tcsh, fish, elvish, powershell, murex, and nushell. Compiled as a single static binary in Go, it is fast enough to be unnoticeable on each prompt. Common use cases include loading 12-factor app environment variables for local development, creating per-project isolated development environments, loading secrets for deployment, and managing language version managers like asdf, rbenv, pyenv, and phpenv. The built-in standard library provides utility functions like PATH_add, dotenv, use_nix, layout commands for various languages, and Python/Node/Ruby virtualenv management. The tool was created by zimbatm and is licensed under MIT, with commercial support available through Numtide. Related projects include mise (which combines direnv, make, and asdf) and asdf-direnv for managing language versions.

Tags & Categories

Categories

Tags

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!