← All tools

direnv Gem

Load and unload environment variables automatically when you cd into a project.

What it is

direnv runs a project's .envrc when you enter the directory and reverts it when you leave, so each project gets its own env vars, PATH additions and secrets without polluting your shell.

Instead of

Manually sourcing .env files, exports in ~/.bashrc

Reach for it when

Different projects need different credentials, endpoints or tool paths.

Try it in a few minutes

brew install direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
echo 'export API_URL=http://localhost:3000' > .envrc
direnv allow

Related

Atuin Gem

Searchable shell history with context, and optional encrypted sync between machines.

Instead of: Ctrl-R and a ~/.bash_history that loses commands

zoxide Gem

A smarter cd that learns the directories you use most.

Instead of: cd ../../.. and long path tab-completion