I use Pyenv which places its shims at the head of the PATH.
I also use Pipenv whose documentation recommends a certain shell-configuration.
pipenv shell --fancy spawns a subshell...however, the order of the PATH variable is different in the subshell.
I've given a simplified example below:
$ fish --version
fish, version 3.0.0
$ uname -a
Darwin MacBook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
$ echo $TERM
xterm-256color
I created a simple config.fish to demonstrate the issue.
Steps to repro:
$ cat ~/.config/fish/config.fish
if status --is-login
set -gx PATH ~/.pyenv/shims $PATH
end
# re-start shell (let me know if there's an easy one-liner spawn a new fish shell with an encapsulated `config.fish`)
$ echo $PATH
/Users/whwkong/.pyenv/shims /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /usr/local/git/bin
$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
$ echo $PATH
/usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /usr/local/git/bin /Users/whwkong/.pyenv/shims
# which affects the Python version of choice
$ which -a python
python is /usr/local/bin/python
python is /usr/bin/python
python is /Users/thepathunfolds/.pyenv/shims/python
The set -gx command in config.fish is not executed in the sub-shell, but I would normally expect that the new sub-shell simply inherits the global PATH variable.
From #4192, and #4336 I understand that Fish adds in the paths from /etc/paths and /etc/paths.d.
Is there a way to enforce the order that these paths are added, so that they are appended, rather than prepended?
I use Pyenv which places its shims at the head of the PATH.
I also use Pipenv whose documentation recommends a certain shell-configuration.
pipenv shell --fancyspawns a subshell...however, the order of the PATH variable is different in the subshell.I've given a simplified example below:
I created a simple
config.fishto demonstrate the issue.Steps to repro:
The
set -gxcommand inconfig.fishis not executed in the sub-shell, but I would normally expect that the new sub-shell simply inherits the global PATH variable.From #4192, and #4336 I understand that Fish adds in the paths from
/etc/pathsand/etc/paths.d.Is there a way to enforce the order that these paths are added, so that they are appended, rather than prepended?