LoginSignup
6
8

More than 5 years have passed since last update.

bundle installでNo pg_configと言われる解決方法。

Last updated at Posted at 2015-05-18

Gemfileにpgというgemを追加してbundle installをしたところ失敗しました。
環境はVagrantのCentOSです。

bundle installが失敗

postgresqlがなくて失敗
bundle install

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

    /home/vagrant/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150518-3729-805ug4.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.

略

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

postgresqlが入っていないので入れるといいみたいです。

postgresqlをインストール

sudo yum install -y postgresql-devel

今度はbundle installが走るようになりました。

参考

6
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
8