31

I'm trying to install the Gemfile contents using Bundle install but getting the error

rbenv: version `2.0.0' is not installed

The version of ruby installed in my system is:

ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]

and rbenv

 2.1.2 (set by /home/jay/.rbenv/version)
 2.1.3

The Gemfile requires ruby "2.0.0". Can any one tell how to install the required version without affecting the existing ones.

5 Answers 5

51

You can find a lot of information here: rbenv on github

To list all available installation candidates:

rbenv install -l

To install a ruby version you need (for example):

rbenv install 2.0.0-p643

So that you will only use this ruby version in this specific folder and not affect anything else you can do:

rbenv local 2.0.0-p643

This will generate a .ruby-version file in that directory which will force rbenv to use this ruby version here.

2
  • 1
    If your desired version does not show up upon rbenv install -l, reinstall ruby-build (on mac: brew reinstall --HEAD ruby-build). The do rbenv install -l.
    – septerr
    Commented Sep 17, 2017 at 19:01
  • @septerr The lower-case -l switch only shows latest stable versions. The upper-case -L shows all available versions. So, before doing what you suggest, I suggest anyone first try the upper-case -L. I found the version I was looking for when I did, and it didn't show up when I used -l.
    – BobRodes
    Commented Mar 16, 2023 at 20:23
5

Just run:

rbenv install 2.0.0-p643

Which is the lastest 2.0.0 version.

If that version is not available on your system, run ruby-build --definitions to pick the lastest known 2.0.0 version on your system.

1
  • 2
    This does not fix the listed error, as 2.0.0-p643 is unequal to 2.0.0.
    – Joost
    Commented Jul 26, 2015 at 22:47
3

You must change the ruby's version in .ruby-version file and in Gemfile

2

For me, I just ran gem install bundler and then run bundle install worked like a charm

0

If you are getting a build failed error when trying to run rbenv install 2.0.0-p643 and after waiting for a few minutes; you might also see the last 10 lines of a log file as an output.

This can give you the hint of what would have happened for the build failure. It might miss some required library/dependency needed to be installed.

For ex. I got the following error for build failure-

ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libreadline-dev` to fetch missing dependencies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.