Why are gems installed in a directory with a different Ruby version than I’m running?
Note that the following is also for all later Ruby versions as of this writing, not just 1.9.2.
Per the 1.9.2 release announcement:
Standard library is installed in
This version is a "library compatible version." Ruby 1.9.2 is almost 1.9.1 compatible, so the library is installed in the 1.9.1 directory.
Even though it is installed in a differently-numbered directory, it is using 1.9.2. RubyGems can show all the directories it’s using via
This ensures that a set of installed gems is only used by versions that they can actually run with (especially due to compiled C extensions), and that when upgrading to a newer, but “library compatible”, version, one doesn’t have to reinstall all gems.
I'm using rbenv, so why are there two Gem paths on my system? (OS X Lion)
I think I figured out the answer to this question, so I'll post it.
Rbenv allows for a global and/or local version of ruby. So once a ruby is installed and managed via rbenv, you can declare it as a global ruby version used by your entire system.
Likewise, you can declare a local ruby version within a given directory (ex: a specific rails project).
The .gem file in your home path is used by the global ruby version, where as the one tucked away in the rbenv directory is used by the local ruby version.
Note, you can (for whatever reason) declare a local version that is the same as the global version. In that case, the local version will rely on the gem files that are in the deeper rbenv directory, instead of the ~/.gem directory.
How to fix Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5 while server starting
You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.
If you're using rvm:
rvm install 2.2.5
rvm use 2.2.5
else if you're using rbenv:
rbenv install 2.2.5
rbenv local 2.2.5
else if you can not change ruby version by rbenv,
Bundle install runs from incorrect directory
Sounds like your app is already using bundler and you have a bundler-inside-bundler problem. Try this:
puts `bundle install`
I'm guessing what's happening is that your outer bundler sets the
BUNDLE_GEMFILE env variable to your app's Gemfile, and then your inner bundler ends up inheriting it.
two different versions of ruby referenced in error message?
This is because 1.9.1 is the Ruby C API version, which allows gems in that directory to be used across Ruby versions which comply with the same Ruby C API version (1.9.1–1.9.3 all use 1.9.1) without needing to recompile C extensions.
How to Get Source Code of a Method Dynamically and Also Which File Is This Method Locate In
Ruby Operator Precedence Table
Confusion With the Assignment Operation Inside a Falsy 'If' Block
Rails :Dependent =≫ :Destroy VS :Dependent =≫ :Delete_All
No Such File to Load - Rubygems (Loaderror)
Your Ruby Version Is 2.0.0, But Your Gemfile Specified 2.1.0
Ruby Array Access 2 Consecutive(Chained) Elements At a Time
What Does the "===" Operator Do in Ruby
Difference Between Include and Require in Ruby
How to Avoid Running Activerecord Callbacks
How to Find and Return a Duplicate Value in Array
Redirect_To Using Post in Rails
Best Practices With Stdin in Ruby
How to Modify Path For Homebrew
Get the Name of the Currently Executing Method