How do I start tmux with my current environment? [closed]

You should configure the tmux session option update-environment to include the variables you want to be updated when creating new sessions. The default value includes several common X11 and SSH variables:

DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY

To add your variables, use the set-option tmux command with its -g and -a flags (append to the existing “global” (default) value). In your ~/.tmux.conf:

set-option -ga update-environment ' YOUR_VAR'

Be sure to include the leading space so that your variable name is separated from the trailing name in the default value.

Leave a Comment