A shell extension that loads and unloads environment variables based on your current directory.
direnv is a shell extension that automatically loads and unloads environment variables based on your current directory. It solves the problem of cluttered global shell profiles by allowing project-specific environment configurations through `.envrc` files. This makes it easy to maintain isolated development environments and manage secrets per project.
Developers working with multiple projects who need isolated shell environments, particularly those using 12-factor apps or managing language-specific toolchains like rbenv, pyenv, or phpenv.
Developers choose direnv because it's fast, shell-agnostic, and secure with its authorization mechanism. Unlike manual environment management, it automatically handles environment changes as you navigate directories, reducing errors and keeping global profiles clean.
unclutter your .profile
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Requires explicit 'direnv allow' for each .envrc file, preventing unauthorized code execution and adding a safety layer, as highlighted in the security-first feature.
Works with bash, zsh, fish, and others, making it versatile for teams with diverse shell preferences, as stated in the shell-agnostic philosophy.
Compiled into a single static executable, it runs fast on every prompt without noticeable lag, ensuring minimal performance impact as described.
Provides utility functions like PATH_add and allows custom extensions via ~/.config/direnv/direnvrc, simplifying common environment manipulations.
As admitted in the FAQ, direnv only exports environment variables from a bash sub-shell, so aliases and shell functions cannot be automatically loaded, limiting customization.
Each .envrc file must be explicitly allowed, which can be tedious in projects with many directories or frequent changes, adding setup overhead.
Primarily designed for Unix-like systems (macOS, Linux), with no native Windows support, restricting use without additional layers like WSL.