Fish会改变$ PATH的顺序吗?如何避免

时间:2019-06-17 10:36:00

标签: macos shell path rvm fish

fish --version
> fish, version 3.0.2

uname -a
> Darwin Jerrys-MacBook.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

echo $TERM
> xterm-256color

我在bash和fish shell中比较了我的$ PATH,rvm的顺序已更改,这导致which pod变得不同(我使用rvm来管理{{ 1}})。

如何使它们顺序相同?

顺便说一句

  • 我已将所有设置都包含在ruby中,并由.bashrc加载到了source ~/.bashrc中,并在.bash_profile中注意到了
  • .prfile中我一无所有

~/.config/fish/config.fishx~=的开始字符只是为了便于比较而添加了标记。

>
----- echo $PATH

=:~/.rvm/gems/ruby-2.2.9/bin
=:~/.rvm/gems/ruby-2.2.9@global/bin
=:~/.rvm/rubies/ruby-2.2.9/bin
X=:/opt/local/bin
X=:/opt/local/sbin
=:~/.nvm/versions/node/v8.11.3/bin
~:/usr/local/bin
~:/usr/bin
~:/bin
~:/usr/sbin
~:/sbin
>:/usr/local/share/dotnet
>:/opt/X11/bin
>:/Library/Frameworks/Mono.framework/Versions/Current/Commands
X-:~/.rvm/bin
X-:~/.local/bin
X-:/usr/local/Cellar/aria2/1.33.1/bin
X-:~/Documents/code/flutter/sdk/flutter/bin
X-:~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-:~/Documents/code/flutter/sdk/flutter/.pub-cache/bin

3 个答案:

答案 0 :(得分:1)

这是this PR的一个简单解决方法,

# Download patched config
curl -O https://raw.githubusercontent.com/fish-shell/fish-shell/e18354bc6ef937e2e663fc098cc51a2546d4d2d0/share/config.fish

# Install config
mv config.fish /usr/local/share/fish/

答案 1 :(得分:0)

这是我的解决方法(仅在zsh上以鱼为互动方式使用鱼):

.zshrc中:

export ZSHPATH="$PATH"

fish

.config/fish/config.fish

set PATH $ZSHPATH $PATH

答案 2 :(得分:-1)

为简单起见,下载并安装fish-2.7.1.pkg版本,该版本在Mac上没有此错误。

根据代码提交,下一版本fish-3.1.0可能会修复此错误。