postmodern / chruby

Changes the current Ruby
MIT License
2.85k stars 190 forks source link

MacVim won't load PATH correctly #394

Open rlue opened 6 years ago

rlue commented 6 years ago

According to the README, chruby.sh should be called from .bashrc:

Add the following to the ~/.bashrc or ~/.zshrc file:

source /usr/local/share/chruby/chruby.sh

However, gvim (MacVim) fails to load PATH appropriately unless it's called from .bash_profile instead. Is there any that it shouldn't be placed in .bash_profile?

My understanding is that profile is for login shells, while rc is for all shells (and that Mac treats all shells as login shells). Are there any scenarios where one would expect to need chruby in a non-login shell that does not inherit its path from a login shell?


Specifically, this is :echo $PATH when sourcing chruby.sh from .bashrc:

/Users/rlue/Library/Python/3.6/bin:/Users/rlue/Scripts:/usr/local/opt/gpg/libexe
c:/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources:/User
s/rlue/Library/Android/sdk/platform-tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin
:/sbin:/Applications/Wireshark.app/Contents/MacOS 

And this is the same command when sourcing chruby.sh from .bash_profile (or .profile):

/Users/rlue/Library/Python/3.6/bin:/Users/rlue/.gem/ruby/2.4.0/bin:/Users/rlue/.
rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/bin:/Users/rlue/.rubies/ruby-2.4.0/bin:/Us
ers/rlue/Scripts:/usr/local/opt/gpg/libexec:/System/Library/Frameworks/JavaScrip
tCore.framework/Versions/A/Resources:/Users/rlue/Library/Android/sdk/platform-to
ols:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Con
tents/MacOS