This is a basic question, but I've been banging my head against a wall trying to fix this and I'm stuck.
I'm cloning a rails project.
When I run bundle install
I get:
Your Ruby version is 2.6.8, but your Gemfile specified 2.5.5
so I tried to make sure that I'm using the right version using rbenv versions
. I get:
system
* 2.5.5 (set by /Users/Mahmoud/dev-reps/non-docker/backend/.ruby-version)
which means that rbenv is using the correct version. Now I run which bundle
:
/usr/local/bin/bundle
which means that bundler is using the system version.
As for which -a bundle
gives:
/usr/local/bin/bundle
/usr/bin/bundle
Also when I run which ruby
or which -a ruby
, I get:
/usr/bin/ruby
Something I tried though, points to light at the end of the tunnel. When [I try based on this post] this1:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
and rerun bundle install, it works. The problem though, the change isn't persistent. I close shell and retry, and I'm right where I started
I've uninstalled and re-installed bundler multiple times after rehashing, etc. but I'm still seeing that rbenv isn't "in control". It tells me one version is in use, but the fact is that the system version is being used.
Update
Based on one of the comments, I uninstalled rbenv and redownloaded. Now after rbenv rehash
I get the following when I type which ruby
:
/Users/Mahmoud/.rbenv/shims/ruby
which is perfect. which bundle
however gives:
/usr/local/bin/bundle
so the problem persists. I also tried gem install bundler
but still when I type bundle install
I'm getting the same problem.
What am I doing wrong?