Problem installing pg-1.1.4 as part of Rails 6 install
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
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.
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 'https://rubygems.org/'
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.
I was able to resolve this by upgrading my bundler version than reinstalling the gem.