-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fish-specific PATH changes get lost when changing ruby versions #31
Comments
I am having similar (the same?) problem. I am unable to prepend to PATH: ~ $ cat ~/.config/fish/config.fish | grep PATH
# Add .bin to PATH
set -x PATH ~/.bin /usr/local/sbin $PATH
~ $ echo $PATH
/Users/foo/.gem/ruby/2.5.0/bin /Users/foo/.rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/bin /Users/foo/.rubies/ruby-2.5.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Users/foo/.bin /usr/local/sbin
~ $ fish --version
fish, version 2.7.1
~ $ chruby --version
chruby: 0.3.9
chruby-fish: 0.8.1
~ $ cat ~/.config/fish/config.fish | tail -n 3
# Ruby manager
source /usr/local/share/chruby/chruby.fish
source /usr/local/share/chruby/auto.fish
~ $ If I drop the |
I've released a new version with some path-related fixes. If you're still using chruby, I encourage you to try it out. I'll close this issue, but feel free to let me know if the problem isn't fixed. I'm not sure I have the time to investigate this anytime soon, but maybe I can squeeze it in somewhere. |
I can confirm this problem is NOT fixed, at least not for my configuration:
As soon as I call
|
Thanks for letting me know @der-flo. I've re-opened the issue, but don't have the time right now to investigate. I'll circle back to this when I can. |
I'm running into this issue too. |
I ran into this as well. In my case, I'm on a M1 and had /opt/homebrew/bin on the PATH, and I was trying to figure out why |
My
PATH
variable is not being properly maintained when chruby-fish changes ruby versions. In particular, anything added to thePATH
variable inconfig.fish
gets lost.In the example below,
/home/tbass/chruby_test/bin
is an empty dir that I added to my path just to illustrate the problem.Not that after changing to 2.4.0,
/home/tbass/chruby_test/bin
is no longer in thePATH
, nor is it there after returning to system ruby.Here is my
config.fish
:I played around a bit and I believe the problem is that when the
bchruby
function invokesbash
, it invokes a login shell, which resets thePATH
according to the bash login process instead of using thePATH
that was passed in as part of the environment. So when it extracts thePATH
back out, it has done more than just apply chruby's modification to the currentPATH
. Instead, it has applied chruby's modification to whatever the bash loginPATH
is, abandoning the originalPATH
altogether.When I remove the
-l
option to thebash
call, it seems to work fine for me, but I don't know if there are any other implications for removing it.The text was updated successfully, but these errors were encountered: