direnv
2024-06-04 → 2025-09-07
An environment switcher for the shell.
Automate the activation of Python virtual environments
You can use it with, e.g., uv.
- Install it.
brew install direnv
- Hook
direnvinto the shell. For instance, add the following into.zshrcor.zshrc.local
eval "$(direnv hook zsh)" # for zsh
- Restart the shell or source it again.
- Go to the project directory and create
.envrcfile.
source .venv/bin/activate
- Give permission
direnv allow