Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 292
Jen Pierce Avatar asked Jun 03 '16 17:06

Jen Pierce


People also ask

What is Rbenv local?

rbenv localSets a local application-specific Ruby version by writing the version name to a .ruby-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the RBENV_VERSION environment variable or with the rbenv shell command.


1 Answers

To add to this, in my case, I first had to run rbenv rehash and then install the bundler gem, and then re-run bundle install. Without all of those steps, it kept the same old Ruby version.

like image 168
swelljoe Avatar answered Sep 22 '22 10:09

swelljoe