Judson Lester edited this page Dec 11, 2017 · 3 revisions

It is recommended to wrap tmux to avoid issues with environment loading.

In Bash / ZSH:

alias tmux='direnv exec / tmux'

In Fish:

alias tmux "direnv exec / tmux"

This will make sure that direnv is unloaded before executing tmux, and avoid issues with environment variables mangling in tmux's subshells.

Alternatively

Rather than aliasing tmux, you can try adding these lines to .tmux.conf or /etc/tmux.conf:

set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES
set-environment -gu DIRENV_LAYOUT
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.