Ask A Question


You’re not receiving notifications from this thread.

Problem installing pg-1.1.4 as part of Rails 6 install

Dean Richardson asked in Gems / Libraries

I'm following the instructions in the post on installing a rails development environment for MacOS Catalina. I'm able to follow the steps up to checking the rails version:

$ rails -v
Could not find pg-1.1.4 in any of the sources
Run bundle install to install missing gems.

When I attempt bundle install, the process terminates do to a failed install of the pg gem:

Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/deanrichardson/.rvm/rubies/ruby-2.6.5/bin/ruby -I
/Users/deanrichardson/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0 -r
./siteconf20191225-4044-8bk372.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:

To see why this extension failed to compile, please check the mkmf.log which can
be found here:


extconf failed, exit code 1

Gem files will remain installed in
/Users/deanrichardson/.rvm/gems/ruby-2.6.5/gems/pg-1.1.4 for inspection.
Results logged to

An error occurred while installing pg (1.1.4), and Bundler cannot
Make sure that gem install pg -v '1.1.4' --source ''
succeeds before bundling.

Any suggestions for diagnosing what might have gone wrong? I've looked at the log file in question and it suggests missing headers.

I've tried using the fix given later in your post:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

and this also generated an error message.


--Dean Richardson


I was able to resolve this by upgrading my bundler version than reinstalling the gem.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,770+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.