Question

I have been trying to run bundle install and I get the following error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/fr/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

Upon following the instructions, I received the following error:

gem install pg -v '0.17.0'                                                    ⏎
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/fr/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

I followed the instructions provided in a similar issue reported earlier. Please see Installing PG gem - failure to build native extension

But this has not helped as shown below:

brew install postgresql
Warning: Could not link postgresql. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link postgresql'

Possible conflicting files are:
==> /usr/local/Cellar/postgresql/9.3.4/bin/initdb /usr/local/var/postgres
==> Summary
🍺  /usr/local/Cellar/postgresql/9.3.4: 2928 files, 38M


brew link postgresql
Linking /usr/local/Cellar/postgresql/9.3.4...
Warning: Could not link postgresql. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/postgresql/9.3.4/share/man/man7/WITH.7
/usr/local/share/man/man7 is not writable. You should change its permissions.

My two concerns are:

  1. How can I fix the issue related to the 'pg' gem?
  2. To fix this issue, is it necessary to modify the read-write permissions of the files mentioned for the brew link postgresql output?
Was it helpful?

Solution

I managed to get the issue solved. The main issue was the pg version - 0.17.0. I installed the latest Postgres.app and verified the version was 0.17.1 upon installation. I then modified the gem file to simply gem 'pg' and ran bundle update. Thanks to everyone for the suggestions and links.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top