direnv command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
direnv: command not found
or when using sudo you get the following error message
sudo: direnv: command not found
Solutions to direnv: command not found
How To Fix direnv: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu direnv is provided by direnv package.
direnv is:
direnv is an environment variable manager for your shell. It knows how to hook into bash, zsh and fish shell to load or unload environment variables depending on your current directory. This allows one to have project-specific environment variables and not clutter the “~/.profile” file.
Before each prompt it checks for the existence of an “.envrc” file in the current and parent directories. If the file exists, it is loaded into a bash sub-shell and all exported variables are then captured by direnv and then made available to your shell.
Because direnv is compiled into a single static executable it is fast enough to be unnoticeable on each prompt. It is also language agnostic and can be used to build solutions similar to rbenv, pyenv, phpenv, …
To fix this problem, we can install more using the command below.
sudo apt-get -y install direnv
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install direnv.
sudo apt -y install direnv
Or if you have aptitude installed you can use the following command.
sudo aptitude install direnv
Summary
In this tutorial we learn how to fix direnv command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.