You are using RubyGems 2.4.1:
$ gem -v 2.4.1
There is a bug with the latest release of version 2.4.1 of RubyGems (system pearl), which makes installing Rails 4.2 difficult. 0.beta1. See Rails issue 16609 .
You can work around the problem by downgrading it to version 2.2.2 of RubyGems.
$ gem update
Now you can install Rails 4.2.0.beta1.
If you are using RVM and you want to use two different versions of the RubyGems system gem, you will need to install two different versions of the latest version of Ruby 2.1.2 with different RVM names . For example, if you already have Ruby 2.1.2 installed with the latest RubyGems 2.4.1, you can install a different version of Ruby 2.1.2 by specifying a different name:
$ rvm install ruby-2.1.2-oldrubygem
RubyGems 2.2.2 is installed by default with the current version of Ruby 2.1.2:
$ ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] $ gem -v 2.2.2
You can install Rails 4.2.0.beta1.
Daniel Kehoe
source share