4

inside shell when

which conda

I get

/anaconda3/bin/conda

while inside tmux I get

/anaconda3/condabin/conda

Anyone knows the difference or something wrong with my config?

Ken Williams
  • 21,252
  • 9
  • 77
  • 138
H.Li
  • 99
  • 1
  • 10
  • I'd guess it probably has to do with tmux sessions not sourcing `.bashrc` (or whatever shell you have). E.g., see [this question](https://stackoverflow.com/questions/9652126/bashrc-profile-is-not-loaded-on-new-tmux-session-or-window-why). – merv Jun 03 '19 at 04:39
  • @merv Now, I reinstalled anaconda3. Both shell(I use iTerm) and tmux will give me /anaconda3/condabin/conda. I am sure I source .bashrc and .bash_profile manually. I found a similar case [here](https://github.com/Microsoft/vscode/issues/69954). But still no idea how to fix it. Any suggestion? thanks – H.Li Jun 03 '19 at 09:46

1 Answers1

2

Finally I found an answer here that worked for me. Basically as @shouya said there, this problem is because tmux's run-shell command runs a shell which doesn't read from user configs, thus tmux installed in /usr/local/bin will not be found. And best solution is to insert the following line:

set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"

before the first run-shell/run command in your ~/.tmux.conf file, and leave everything else untouched. Then reload ~/.tmux.conf file by

tmux source-file ~/.tmux.conf
H.Li
  • 99
  • 1
  • 10