Jen Pierce Jen Pierce - 4 months ago 10
Ruby Question

Bundle install not using rbenv local Ruby version

I am trying to install gems for a new Rails project using bundler:

$ bundle install --path


I've set my local Ruby version to 2.3.1 using rbenv, but bundler is still using my system Ruby (2.0.0).

$ rbenv local
2.3.1

$ echo $PATH
/Users/jenniferpierce/.rbenv/shims:/Users/jenniferpierce/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/PostgreSQL/9.5/bin

$ which ruby
/Users/jenniferpierce/.rbenv/shims/ruby

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

$ bundle install --path
Your Ruby version is 2.0.0, but your Gemfile specified 2.3.1


My bash profile includes:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"


I've run:

$ rbenv rehash


and restarted my terminal. Maybe I'm missing something super obvious? Any ideas would be appreciated.

Answer

You should be able to just run bundle install without the --path. I believe --path allows you to specify a different path than the one in your system, but if you modified your bash profile as you suggested, there is no need for that.

Also, if you just changed your ruby version for the local folder, you should run a gem install bundler.