"Gem::InstallError: devise requires Ruby version >= 2.1.0." when running Ruby 2.3.1
<p>In my continuous integration machine I'm running Ruby 2.3.1p112:</p>

<pre><code>$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
</code></pre>

<p>but when I try to install gems I get an error that makes no sense:</p>

<pre><code>$ bundle install --deployment
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using rake 10.5.0
Using i18n 0.7.0
Using json 1.8.3
...
Installing devise 4.0.1

Gem::InstallError: devise requires Ruby version &gt;= 2.1.0.
An error occurred while installing devise (4.0.1), and Bundler cannot continue.
Make sure that `gem install devise -v '4.0.1'` succeeds before bundling.
</code></pre>

<p>installing the gem globally works:</p>

<pre><code>$ sudo gem install devise -v '4.0.1'
Successfully installed devise-4.0.1
Parsing documentation for devise-4.0.1
Done installing documentation for devise after 1 seconds
1 gem installed
</code></pre>

<p>but it makes no difference. The complaint about Rubygems is also odd, as I'm running 2.6.4:</p>

<pre><code>$ update_rubygems
RubyGems 2.6.4 installed
</code></pre>

<p>Any ideas what might be going on?</p>

<p>My Gemfile looks like this:</p>

<pre><code>source "https://rubygems.org"

gem "activerecord-session_store", "~&gt; 0.1.2"
gem "bootstrap-sass", "~&gt; 3.3.6"
gem "breadcrumbs_on_rails", "~&gt; 2.3.1"
gem "coffee-rails", "~&gt; 4.1.0"
gem "delayed_job_active_record", "~&gt; 4.1.0"
gem "devise", "~&gt; 4.0.0"
gem "devise_invitable", git: "https://github.com/scambra/devise_invitable.git" # Using master because the current release version seems not to work with Devise 4.0.
gem "font-awesome-rails", "~&gt; 4.6.1.0"
gem "gibbon", "~&gt; 2.2.3"
gem "haml-rails", "~&gt; 0.9"
gem "html5shiv-rails", "~&gt; 0.0.2"
gem "jbuilder", "~&gt; 2.0"
gem "jquery-rails"
gem "paper_trail", "~&gt; 4.1.0"
gem "paranoia", "~&gt; 2.1.5"
gem "pg", "~&gt; 0.15"
gem "pundit", "~&gt; 1.1.0"
gem "rack-timeout", "~&gt; 0.4.2"
gem "rails", "~&gt; 4.2.6"
gem "redcarpet", "~&gt; 3.3.4"
gem "respond-rails", "~&gt; 1.0"
gem "rest-client", "~&gt; 1.8.0"
gem "rollbar", "~&gt; 2.11.2"
gem "sass-rails", "~&gt; 5.0"
gem "sdoc", "~&gt; 0.4.0", group: :doc
gem "simple_form", "~&gt; 3.2.1"
gem "stripe", "~&gt; 1.41.0"
gem "validation_auditor", "~&gt; 1.0.0"
gem "uglifier", "&gt;= 1.3.0"

group :development do
  gem "quiet_assets"
  gem "spring"
  gem "web-console", "~&gt; 2.0"
end

group :development, :test do
  gem "annotate", "~&gt; 2.6.5"
  gem "byebug" # Call "byebug" anywhere in the code to stop execution and get a debugger console
  gem "database_cleaner", "~&gt; 1.5.3"
  gem "factory_girl_rails", "~&gt; 4.7.0"
end

group :development, :staging do
  gem "mail_safe", "~&gt; 0.3.4"
end

group :test do
  gem "assert_difference", "~&gt; 1.0.0"
  gem "bundler-audit", "~&gt; 0.5.0"
  gem "capybara", "~&gt; 2.7.0"
  gem "capybara-email", "~&gt; 2.5.0"
  gem "capybara_minitest_spec", "~&gt; 1.0.5"
  gem "simplecov", "~&gt; 0.11.2", require: false
  gem "shoulda-context", "~&gt; 1.2.1"
  gem "poltergeist", "~&gt; 1.9.0"
end

group :production, :staging do
  gem "unicorn-rails", "~&gt; 2.2.0"
end
</code></pre>

<p>I'm not using RVM nor any other Ruby/Gem manager.</p>