Skip to content
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

vim not loading correct ruby version #382

Closed
elle opened this issue Dec 9, 2016 · 3 comments
Closed

vim not loading correct ruby version #382

elle opened this issue Dec 9, 2016 · 3 comments

Comments

@elle
Copy link

elle commented Dec 9, 2016

This is a similar problem to #196 but for some reason, I cannot get vim to load correct Ruby version.

My dotfiles are are: https://github.com/elle/dotfiles
But for summary, I have the following set up:

# ~/.zshrc
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh

# ~/.vimrc
set shell=$SHELL\ -l

I actually needed to move sourcing chruby to ~/.zshenv to be able to see it in vim.

I also: sudo mv /etc/zshenv /etc/zprofile

Still, in iTerm, I get:

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]

...but in vim, I get:

:!ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin14] 

Lastly, when checking the $PATH in vim, I get:

:!echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/em/.gem/ruby/2.3.1/bin:/Users/em/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bin:/Users/em/.rubies/ruby-2.3.1/bin:/Users/em/bin

And when I try to run a test file via vim-test plugin, I get the following error:

`validate_ruby!': Your Ruby version is 2.3.3, but your Gemfile specified 2.3.1 (Bundler::RubyVersi
onMismatch)

Any ideas why this is not working for me?

@postmodern
Copy link
Owner

Something appears to be moving /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin to the front of $PATH, when it should be at the end.

@havenwood
Copy link
Collaborator

@elle It looks like you modified PATH in your ~/.zshrc to appease Homebrew. I'd suggest removing the PATH="...:$PATH" line from your ~/.zshrc file and instead reordering the lines in your /etc/paths file to something like:

/usr/local/bin
/usr/local/sbin
/usr/bin
/usr/sbin
/bin
/sbin

Then rerun brew doctor and make sure Homebrew is happy with your new PATH order.

@havenwood
Copy link
Collaborator

Closing this since the cause of the issue was determined to be manual path munging in the ~/.zshrc file.

As mentioned above, a nice fix is to reorder /etc/paths instead of munging PATH in the dotfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants