Bundler finds the wrong version of ruby

I am using OS X 10.10.5 (Yosemite). I am trying to clone a github repo for MacDown. The instructions in README say that after cloning you should do

git submodule init git submodule update bundle install bundle exec pod install 

I am not a ruby ​​programmer, so I had to install the Bundler. The first two steps went fine, but when I tried to run bundle install , I got an error

 activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.0.0p481 

So I tried brew install ruby , and now I have

 saul@miniMac ✓ ruby --version ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14] 

However, bundle install gives me the same error message as before. Clearly, he finds a ruby ​​at /usr/bin/ruby instead of one at /usr/local/bin/ruby . How to fix it?

I thought that maybe the problem was that I installed the bundle before updating ruby, but sudo gem uninstall bundler and sudo gem uninstall bundle have no effect, and I don't know what else to try.

Here is the whole conclusion, if it matters:

 saul@miniMac ✓ bundle install Fetching gem metadata from https://rubygems.org/.......... Fetching version metadata from https://rubygems.org/.. Fetching dependency metadata from https://rubygems.org/. Resolving dependencies... activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.0.0p481 

EDIT:

Thanks for the suggestions. I tried the gem install bundler again, but that didn't help. I have the same error message. Here is what I get from bundle env

 saul@miniMac ✗ bundle env Environment Bundler 1.13.6 Rubygems 2.0.14 Ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] Git 2.5.4 (Apple Git-61) Gemfile source 'https://rubygems.org' gem 'cocoapods', '0.39.0' Gemfile.lock <No /Users/saul/Projects/macdown/Gemfile.lock found> 

EDIT 2:

 saul@miniMac ✓ which -a bundle /usr/local/bin/bundle /usr/bin/bundle 
+5
source share
1 answer

It seems that your PATH might have an entry pointing to your earlier version of Ruby, and although it has a newer version (2.3.1), it uses the first ruby ​​binary code that it finds in one of the entries that it finds in your PATH, which is an old version. You can try to add your last Ruby path as the first record of your PATH variable, but if you run the sub-shell and load the default PATH, the path to your last Ruby will be overwritten. In doing so, I find it easiest to use rvm here to make sure your environment is configured for the version that you intend to use at any given time. RVM can manage multiple versions of ruby ​​on the same system. Read more about RVM here .

Run all of the following commands in the same terminal window:

  • Install rvm: curl -sSL https://get.rvm.io | bash -s stable
  • Add rvm binary to PATH: export PATH = "$ PATH: $ HOME / .rvm / bin"
  • Install the required ruby ​​version: rvm install 2.3.1
  • Configure the current shell to use a specific version of Ruby: rvm use 2.3.1
  • Run package install again
+2
source

Source: https://habr.com/ru/post/1259300/


All Articles