
About direnv
direnv is a small shell extension that changes your environment variables based on the folder you are in. It works quietly in the background, so each project can keep its own settings without cluttering your shell profile.
What it does
Before each shell prompt, direnv looks for a .envrc file in the current folder and its parents. If the file exists and you have approved it, direnv loads its variables into your shell. When you leave the folder, the variables are unloaded again. The tool is built as a single program, so it is fast enough to run on every prompt.
Key features
- Load variables when you enter a project folder
- Unload them automatically when you leave
- Approval step before a file is allowed to run
- Hooks for bash, zsh, fish and other shells
- Keep project secrets out of your shell profile
Who it's for
Developers who work on several projects with different tools, versions or credentials. It is also useful for teams that want isolated environments for each project.
Pricing and good to know
direnv is free and released under the MIT licence. It runs on Unix-like systems such as macOS and Linux, and most Linux distributions package it. Some features store files in a .direnv folder, which is usually added to .gitignore so it stays out of version control.
Highlights
- Load variables when you enter a project folder
- Unload them automatically when you leave
- Approval step before a file is allowed to run
- Hooks for bash, zsh, fish and other shells
- Keep project secrets out of your shell profile












