# Install direnv with Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, scoop, winget, zypper

Load/unload environment variables based on $PWD. Version 2.37.1 via Homebrew; verified 2026-06-22.

## Install

```sh
sudo av install brew:direnv
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install direnv
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install direnv
```

  Evidence: MacPorts ports tree: devel/direnv/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add direnv
```

  Evidence: Alpine Linux edge package indexes: direnv from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install direnv
```

  Evidence: Debian stable package indexes: direnv from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install direnv
```

  Evidence: Fedora Rawhide package metadata: direnv from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#direnv
```

  Evidence: nixpkgs package indexes: pkgs/by-name/di/direnv/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S direnv
```

  Evidence: Arch Linux sync databases: direnv from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install direnv
```

  Evidence: openSUSE Tumbleweed package metadata: direnv from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/direnv
```

  Evidence: Scoop official bucket manifest trees: bucket/direnv.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id direnv.direnv -e
```

  Evidence: Windows Package Manager source index: direnv.direnv from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:direnv
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/direnv>
- **Version:** 2.37.1
- **Source summary:** Load/unload environment variables based on $PWD
- **Homepage:** <https://direnv.net/>
- **Repository:** <https://github.com/direnv/direnv>
- **Upstream docs:** <https://direnv.net/docs>
- **License:** MIT
- **Source archive:** <https://github.com/direnv/direnv/archive/refs/tags/v2.37.1.tar.gz>
- **Last updated:** 2026-06-22T14:03:09-07:00
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- direnv (cli)
- direnv (alias)

## Dependencies

- bash

## Build dependencies

- go

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.37.1
- Package-manager updated: 2026-06-22
- Local data: ok
- Upstream repository: https://github.com/direnv/direnv
- Upstream latest detected: v2.37.1 (current)
## Project history and usage

direnv is a shell extension for loading and unloading project-specific environment variables as the current working directory changes.

### Project history

The project frames itself as a way to unclutter shell startup files: instead of putting every export in a global profile, a project can keep an authorized .envrc near its source tree. Its README and man page describe a small, language-agnostic executable that hooks into interactive shells and evaluates environment changes in a subprocess.

### Adoption history

Official installation documentation lists packages or install paths for Fedora, Arch Linux, Debian, Gentoo Guru, NetBSD pkgsrc-wip, NixOS, Homebrew, openSUSE, MacPorts, Ubuntu, GNU Guix, and Windows winget. That packaging spread matches direnv's role as cross-language glue for local development environments.

### How it is used

The common workflow is to install direnv, hook it into the user's shell, create a project .envrc, and explicitly allow that file before it is evaluated. The README highlights 12-factor environment variables, isolated development environments, deployment secrets, and integrations with tools such as Nix and language version managers.

### Why package nerds care

Package nerds care about direnv because it solves a small boundary problem cleanly: it lets shells, package managers, language managers, and project repositories cooperate without turning into a full environment manager.

### Timeline

- 2011: GitHub repository created.
- 2019: direnv.toml manual documents the TOML config file path.
- 2025: v2.37.1 published on GitHub releases.

### Related projects

- The official README points users toward adjacent tools including Environment Modules, autoenv, zsh-autoenv, asdf, shadowenv, quickenv, and mise.

### Sources

- <https://github.com/direnv/direnv>
- <https://github.com/direnv/direnv/blob/master/README.md>
- <https://github.com/direnv/direnv/blob/master/docs/installation.md>
- <https://github.com/direnv/direnv/blob/master/man/direnv.1.md>
- <https://github.com/direnv/direnv/blob/master/man/direnv.toml.1.md>
- <https://github.com/direnv/direnv/releases/tag/v2.37.1>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: $XDG_CONFIG_HOME/direnv/direnv.toml, ~/.config/direnv/direnv.toml, ~/.config/direnv/direnvrc, .envrc
## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** direnv
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - direnv - 2.32.1-2+b16: normalized package name match | Debian stable package indexes: direnv from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Utility to set directory specific environment variables | http://direnv.net/
- Nix - direnv: normalized package name match | nixpkgs package indexes: pkgs/by-name/di/direnv/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - direnv - 2.32.1-2build1: normalized package name match | Ubuntu 24.04 LTS package indexes: direnv from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Utility to set directory specific environment variables | http://direnv.net/
- apk - direnv - 2.37.1-r7: normalized package name match | Alpine Linux edge package indexes: direnv from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Environment variable switcher for the shell | https://direnv.net
- apk - direnv-doc - 2.37.1-r7: normalized package name match | Alpine Linux edge package indexes: direnv-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Environment variable switcher for the shell (documentation) | https://direnv.net
- apk - direnv-fish - 2.37.1-r7: normalized package name match | Alpine Linux edge package indexes: direnv-fish from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | configuration hooks for fish | https://direnv.net
- dnf - direnv - 2.37.1-6.fc44: normalized package name match | Fedora Rawhide package metadata: direnv from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Per-directory shell configuration tool | https://github.com/direnv/direnv
- pacman - direnv - 2.37.1-1: normalized package name match | Arch Linux sync databases: direnv from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A shell extension that manages your environment | https://direnv.net
- zypper - direnv - 2.37.1-1.4: normalized package name match | openSUSE Tumbleweed package metadata: direnv from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Environment switcher for shells | https://direnv.net/
- zypper - direnv-bash-completion - 2.37.1-1.4: normalized package name match | openSUSE Tumbleweed package metadata: direnv-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Bash Completion for direnv | https://direnv.net/
- zypper - direnv-fish-completion - 2.37.1-1.4: normalized package name match | openSUSE Tumbleweed package metadata: direnv-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Fish Completion for direnv | https://direnv.net/
- zypper - direnv-zsh-completion - 2.37.1-1.4: normalized package name match | openSUSE Tumbleweed package metadata: direnv-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Zsh Completion for direnv | https://direnv.net/
- MacPorts - direnv: normalized package name match | MacPorts ports tree: devel/direnv/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/direnv: normalized package name match | Scoop official bucket manifest trees: bucket/direnv.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - direnv.direnv: normalized package name match | Windows Package Manager source index: direnv.direnv from https://cdn.winget.microsoft.com/cache/source.msix


## Related links

- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [bash](https://www.automicvault.com/pkg/brew/bash/) - Runtime dependency declared by Homebrew.
- [go](https://www.automicvault.com/pkg/brew/go/) - Build dependency declared by Homebrew.
- [shadowenv](https://www.automicvault.com/pkg/brew/shadowenv/) - Shares av.db curated category or tags: cli, developer-tools, environment-management, environment-variables, shell.
- [modules](https://www.automicvault.com/pkg/brew/modules/) - Shares av.db curated category or tags: cli, developer-tools, environment-management, shell.
- [virtualenvwrapper](https://www.automicvault.com/pkg/brew/virtualenvwrapper/) - Shares av.db curated category or tags: cli, developer-tools, environment-management, shell.
- [envv](https://www.automicvault.com/pkg/brew/envv/) - Shares av.db curated category or tags: cli, developer-tools, environment-variables, shell.
- [fades](https://www.automicvault.com/pkg/brew/fades/) - Shares av.db curated category or tags: cli, developer-tools, environment-management.
- [hermit](https://www.automicvault.com/pkg/brew/hermit/) - Shares av.db curated category or tags: cli, developer-tools, environment-management.
- [pyenv-pip-migrate](https://www.automicvault.com/pkg/brew/pyenv-pip-migrate/) - Shares av.db curated category or tags: cli, developer-tools, environment-management.
- [pyenv-virtualenv](https://www.automicvault.com/pkg/brew/pyenv-virtualenv/) - Shares av.db curated category or tags: cli, developer-tools, environment-management.

## Combined YAML source

View the package source record on GitHub. [combined/direnv.yml](https://github.com/automic-vault/db/blob/main/combined/direnv.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
