My PATH Prefixes Don't Persist
I'm using Fish v3.2.0. According to the documentation, set -U fish_user_paths should persistently ensure that the directories stored in it should be looked up before other items in the PATH. However, it's inheriting PATH from somewhere else (a parent shell? a startup file of some kind?) and the PATH only changes if I manually set things in each shell instance.
What Works (Temporarily)
> echo $PATH
/usr/bin /bin /usr/sbin /sbin /usr/local/opt/python@3.9/libexec/bin/python
This works, temporarily. It just doesn't persist.
> set -U fish_user_paths /usr/local/opt/python@3.9/libexec/bin
> set -SL fish_user_paths
$fish_user_paths: set in universal scope, unexported, with 1 elements
$fish_user_paths[1]: |/usr/local/opt/python@3.9/libexec/bin|
> which -a python
/usr/local/opt/python@3.9/libexec/bin/python
/usr/bin/python
What Doesn't Work
# The changes to fish_user_paths don't get picked up
# by new invocations or subshells.
> exec fish -li
> which -a python
/usr/bin/python
/usr/local/opt/python@3.9/libexec/bin/python
> set -SL fish_user_paths
$fish_user_paths: set in universal scope, unexported, with 1 elements
$fish_user_paths[1]: |/usr/local/opt/python@3.9/libexec/bin|
> set -SL PATH
$PATH: set in global scope, exported, a path variable with 5 elements
$PATH[1]: |/usr/bin|
$PATH[2]: |/bin|
$PATH[3]: |/usr/sbin|
$PATH[4]: |/sbin|
$PATH[5]: |/usr/local/opt/python@3.9/libexec/bin/python|
Even trying to move the item doesn't seem to work.
> fish_add_path -Ppmg /usr/local/opt/python@3.9/libexec/bin/python
> echo $status
1
Questions
These questions seem interrelated to me. I'm trying to discover:
- Where is fish getting PATH from when I haven't set it explicitly?
- Why can't I retain my PATH changes across shell instances?
- Why am I getting an error when trying to use
fish_add_pathto modify PATH directly?