Home/Tools/direnv
d
Install via:brewgo
License:MIT
Open source

direnv

About

An environment switcher for the shell that loads per-directory `.envrc` files automatically. Keep project-specific environment variables and PATHs isolated.

Pricing

Free

direnv is a per-directory environment manager. When you cd into a project, it loads the .envrc file — setting variables, adding to PATH, or running any shell code — and unloads it when you leave.

Key Features

  • Automatic env loading on cd.
  • .envrc files per project, committed with the repo.
  • Shell hooks for bash, zsh, fish, nushell.
  • use node, use python helpers via stdlib.
  • Env diff detection and reload.
  • Safe: prompts on first use, whitelisting.

Pricing

direnv is free and open source under the MIT license.

Getting Started

brew install direnv
# add to ~/.zshrc
eval "$(direnv hook zsh)"
# in a project:
echo 'export DATABASE_URL=postgres://localhost/db' > .envrc
direnv allow