my .bashrc has these lines at the bottom:

if [ -f $HOME/tools/bashrc ]; then
        source $HOME/tools/bashrc

and $HOME/tools/bashrc has this code at the bottom:

eval "$(pyenv init -)"
pyenv virtualenvwrapper_lazy
eval "$(direnv hook bash)"

but when I access directories that contain .envrc, it's not reading it. I even tried to add echo just above the eval "$(direnv hook bash)" and it's echoing the text ok upon login or opening a new bash.

One interesting thing is this: When I access a directory that has .envrc in it, then run tmux new -s <name>, it will open a new bash and read the .envrc. But when I access another directory that has .envrc on that same tmux session, still does read it.

The only way for me to make it work is by manually typing eval "$(direnv hook bash)" upon login, which not ideal.

I even tried hardcoding everything at the bottom of ~/.bashrc but still the same behavior. Is anyone has an idea? Thanks!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.