Fish shell and rvm - allowing login shell

2019-07-24 12:16发布

问题:

When I try to use rvm in fish shell, I get this message:

ciembor@ciembor ~> rvm use 1.9.2

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example.

I get used to use /bin/bash --login, then rvm and then starting fish from bash. But isn't there more straightforward way? I use xfce4 terminal.

回答1:

I had the same issue. Download the rvm fish function from GitHub:

curl --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish

Reference: http://rvm.io/integration/fish



回答2:

Download the fish functions from GitHub.

curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish

And activate the default Ruby manually in your config.fish file:

echo "rvm default" >> ~/.config/fish/config.fish

And you're done



回答3:

Try look at bash "initialization" files like ~/.bashrc ~/.bash_profile and session "initialization" files ~/.profile /etc/profile* and add rvm related code(something like

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

) to fish "initialization" file ~/.config/fish/config.fish