10

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.

Jen Pierce
  • 103
  • 1
  • 4

2 Answers2

17

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.

swelljoe
  • 808
  • 5
  • 17
  • 1
    For me, running `rbenv rehash` was enough; I didn't need to reinstall the bundler gem. – Sam Oct 27 '20 at 09:46
3

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.

RodCardenas
  • 585
  • 6
  • 14