# direnv

> unclutter your .profile

Source: https://talira.ai/catalog/direnv-17mnbtmy
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / environment / env vars](https://talira.ai/categories/developer-tools/environment/env-vars), [developer tools / terminal / shell](https://talira.ai/categories/developer-tools/terminal/shell)
- Platforms: macos, linux, cli
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes

direnv is a shell extension that loads and unloads environment variables depending on the current directory. Before each prompt it looks for an authorized .envrc (optionally .env) in the current and parent directories, evaluates it in a bash subshell and exports the result into your shell. It is a single static binary with hooks for bash, zsh, [fish](https://talira.ai/catalog/fish-d4tkn14g.md), tcsh, elvish, PowerShell, murex and nushell.

## Links

- Website: https://direnv.net
- GitHub: https://github.com/direnv/direnv

## Ways to install

### Package managers

- [Homebrew](https://talira.ai/catalog/homebrew-djy17yn9.md): <https://formulae.brew.sh/formula/direnv>[^1]
- [APT](https://talira.ai/catalog/apt-d7essv0z.md): <https://packages.debian.org/stable/direnv>[^2]
- [mise](https://talira.ai/catalog/mise-0axr08xw.md): <https://mise-versions.jdx.dev/tools/direnv>[^3]

## Problems it solves

- load a project's environment variables automatically when I cd into it
- my .zshrc is full of exports for different projects
- unset API keys when I leave a project directory
- activate the right virtualenv automatically per folder
- different AWS profiles for different repos without remembering to switch
- per-directory PATH additions like node_modules/.bin
- load a .env file into my shell, not just into the app
- hook nix shell or other dev environments into my normal shell
- I keep forgetting to source the project env file before running commands
- different AWS credentials per project directory
- set environment variables only while I am inside a project folder
- my .bashrc is full of project-specific exports
- automatically activate the right virtualenv when I cd into a repo
- load 12-factor app config from a file in development
- unset project env vars automatically when I leave the folder
- per-directory PATH additions for project scripts

## Features

- .envrc per directory
- authorization of env files
- optional .env loading
- stdlib helpers
- many shells supported
- .envrc loading/unloading
- explicit allow for security
- optional .env support
- many shell hooks

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.69 out of 1.
Signals: maintenance 1.00, adoption 0.84, momentum 0.58, community 0.99, backing 0.00, extensibility 0.20.

- last commit 29 days ago
- 113 commits in the last 90 days
- latest release v2.38.2 45 days ago
- 15.5k GitHub stars
- 292 contributors

## Alternatives

- [mise](https://talira.ai/catalog/mise-0axr08xw.md): dev tools, env vars, task runner
- [devenv](https://talira.ai/catalog/devenv-zh8v4g3n.md): Declarative, reproducible developer environments using Nix
- [Devbox](https://talira.ai/catalog/devbox-sfmcr3v4.md): Instant, easy, and predictable development environments

## Sources

[^1]: https://formulae.brew.sh/api/formula.json (checked 21 Nov 2026)
[^2]: https://deb.debian.org/debian/dists/stable/main/source/Sources.xz (checked 21 Nov 2026)
[^3]: https://mise-versions.jdx.dev/tools.json (checked 21 Nov 2026)
