Q:

Capybara gem installation error in Ubuntu12

Iam trying to execute command the bundle install it is showing the error message
Gem::InstallError: capybara requires Ruby version >= 1.9.3.
An error occurred while installing capybara (2.1.0), and Bundler cannot continue.
Make sure that `gem install capybara -v '2.1.0'` succeeds before bundling.

so i upgrade my ruby 1.8.2 to ruby 1.9.3 and set this as default in rvm.
$ rvm list
rvm rubies

=* ruby-1.9.3-p448 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

 $ ruby -v

iam getting ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
same error obtaining when executing bundle install .
because of using rvm i use the command gem install capybara -v '2.1.0' iam getting 
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /var/lib/gems/1.9.1 directory

later i tried sudo gem install capybara -v '2.1.0'
it successfully installed
so again i used the bundle install command to install remaing gems in my gem file it agian showing the same above mentioned error.
Gem::InstallError: capybara requires Ruby version >= 1.9.3.
An error occurred while installing capybara (2.1.0), and Bundler cannot continue.
Make sure that `gem install capybara -v '2.1.0'` succeeds before bundling.

A:

I suggest you to set project dependent rvm settings.
Goto to your project folder and do the following:
echo "ruby-1.9.3-p448" > .ruby-version
echo "myapp" > .ruby-gemset

Close the console, reopen it and once again go to your project folder. Then, verify you ruby version is 1.9.3-p448 (ruby -v) and do the following:
gem install bundler
bundle install

For more details, see this answer

