0

When I run bundle install I get this error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/pg-0.18.4/ext
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160601-64492-1nt86nq.rb 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 ***

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.

... [a long list of config options] ...

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

Then when I try gem install pg -v '0.18.4' like it suggests I get the same error without the suggestion to run the command I just tried. I'm not running postgres and have never installed it, so I'm a bit confused about why this is happening.

There is a similar question here, but again, I don't have postgresql. Do I need it? Question: gem install pg -v 0.12.2 error on mac

Any help is appreciated. Thank you.

Community
  • 1
  • 1
Rose
  • 363
  • 1
  • 3
  • 13
  • Do you want to use PostgreSQL? If yes, then install PostgreSQL before you install the `pg` gem. Otherwise remove the `pg` gem from your `Gemfile` and replace it with a gem for the database you want to use (`sqlite`, `mysql2`). – spickermann Jun 01 '16 at 15:08
  • This might help: http://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem – pmichna Jun 01 '16 at 15:09

1 Answers1

0

Yes, in order to install the pg gem you must have postgresql installed. You can find downloads and install instruction on their website.

Specifically it says you need a pg_config file, which I guess would be created upon installation.

thesecretmaster
  • 1,950
  • 1
  • 27
  • 39