35

In a Rails application, with a bare pg requirement in your Gemfile:

gem 'pg'

You'll get the following error:

Gem::LoadError can't activate pg (~> 0.18), already activated pg-1.0.0. Make sure all dependencies are added to Gemfile.
1
  • 1
    The same thing happens for Sinatra applications as well Commented Jan 12, 2018 at 12:40

1 Answer 1

64

The pg gem recently released version 1.0.0 which is not yet compatible with Rails.

If you're on Rails 5, change your Gemfile's pg requirement to the following1:

gem 'pg', '~> 0.18'

or on Rails < 5, this:

gem 'pg', '~> 0.11'

And then run

bundle update pg


1 Bundler will effectively do the exact same thing with either line, but this way you'll match the Rails source code's runtime check exactly, as well as the version emitted by rails new's Gemfile generator.

Sign up to request clarification or add additional context in comments.

1 Comment

Bundler attempted to update pg but its version stayed the same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.