tmux 不加载 asdf 配置

tmux not loading asdf config

我在创建 tmux 会话时无法加载 ruby/node 的正确版本。如果我在没有 tmux

的情况下使用 ruby/node,则不会发生这种情况
$ tmux new-session -s servers
$ which ruby
/usr/bin/ruby

与普通终端会话相比:

/Users/amree/.asdf/shims/ruby

相关点文件:

更多信息

实际问题是因为当我打开 tmux 会话时 $PATH 又被 /etc/zprofile 自动添加了前缀。

为了防止这种情况,我只是在 tmux 会话中禁用它:

# /etc/zprofile
# system-wide environment settings for zsh(1)
if [ -x /usr/libexec/path_helper ]; then
  if [ -z "$TMUX" ]; then
    eval `/usr/libexec/path_helper -s`
  fi
fi