I have installed a new rails project like so:
$ rails new site
and it executes and reaches:
bundle install
<
This error can occur if you are bundling with the wrong version of ruby for the bundle. Check the Gemfile for the ruby version and then check the output of ruby -v
. If there is a version mismatch, use rvm to make sure you are using the same version of ruby, then re-bundle.
I got this exact error and fixed it by changing the version of ruby I was using.
I had the same problem when installed rails. My ruby version is 1.9.3 p448 and OS is OS X Mavericks (10.9.2).
Here's what I tried and it works.
$ gem install rails --version 4.0.4
[ref] http://ruby.railstutorial.org/chapters/beginning#top
I had this same problem and what worked for me was installing RVM, installing Ruby 2.1.1 (an upgrade from the 2.0 that comes packaged in Mavericks)...
rvm get stable
rvm reinstall 2.1.1
(use whatever the latest version is, for me that's 2.1.1)
...and then run rvm use 2.1.1
to make sure that I had switched to using that version.
After that, my gem installs ran smoothly.