I set Fish as a login shell referenced here(https://fishshell.com/docs/current/index.html#default-shell).
Then installed rbenv
.
But I have to reload Fish shell to call rbenv
.
Easy to understand to look at below.
yas ~ ps -f
UID PID PPID C STIME TTY TIME CMD
501 55722 55721 0 5:09PM ttys001 0:00.02 -fish //set fish as login shell
yas ~ rbenv // couldn't find rbenv
fish: Unknown command: rbenv
yas ~ echo $PATH // couldn't find a path to rbenv
/Users/yas/.anyenv/envs/pyenv/shims /opt/homebrew/bin /opt/homebrew/sbin /opt/homebrew/opt/[email protected]/bin /opt/homebrew/opt/openssl@3/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Users/yas/.anyenv/envs/pyenv/bin
yas ~ exec $SHELL -l // Reloading the shell
yas ~ rbenv --version // succeeded
rbenv 1.2.0-14-gc6cc0a1
yas ~ echo $PATH // Paths are added after reloading the shell.
/Users/yas/.anyenv/envs/rbenv/shims /Users/yas/.anyenv/envs/pyenv/shims /opt/homebrew/bin /opt/homebrew/sbin /opt/homebrew/opt/[email protected]/bin /opt/homebrew/opt/openssl@3/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/homebrew/bin /opt/homebrew/sbin /Users/yas/.anyenv/envs/pyenv/bin /Users/yas/.anyenv/envs/pyenv/bin /Users/yas/.anyenv/envs/rbenv/bin
yas ~ ps -f // shell path has changed from -fish after reloading.
UID PID PPID C STIME TTY TIME CMD
501 55722 55721 0 5:09PM ttys001 0:00.16 /opt/homebrew/bin/fish -l
Inside ~/.config/fish/config.fish
if status is-interactive
# Commands to run in interactive sessions can go here
end
eval (/opt/homebrew/bin/brew shellenv)
status --is-interactive; and source (anyenv init -|psub)
set fish_function_path $fish_function_path "/Users/yas/.anyenv/envs/pyenv/versions/3.10.5/lib/python3.10/site-packages/powerline/bindings/fish"
powerline-setup
I don't like to type exec $SHELL -l
on every launch.
Does anyone help me out with this?
CodePudding user response:
This is https://github.com/anyenv/anyenv/pull/99 - anyenv's pyenv setup interferes with other envs:
In the current situation, pyenv init --path also causes a problem with anyenv. When logging into zsh, the initialization process stops at pyenv and further (such as rbenv, or sbtenv) are impossible.
As a workaround, it should be possible to just run anyenv init -
twice, since it seems that the pyenv setup is skipped or succeeds the second time around (this would be what fixes it when you run fish twice!):
status --is-interactive; and source (anyenv init -|psub)
status --is-interactive; and source (anyenv init -|psub)
Which can be simplified to
if status is-interactive
anyenv init - | source
anyenv init - | source
end