mozyのかきおき

mozyの読書感想文や思考置き場

【解決】gem install pg でコケる

起きたこと

$ bundle install 時に、

An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that `gem install pg -v '1.0.0' --source 'https://rubygems.org/'` succeeds before bundling.

てな感じのエラーが出た。

よく見ると、

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.

というエラーが出ていて、libpq-fe.hに関して調べるとpostgresql関連のファイルだった。

解決策

Macだったため、
$ brew install postgresqlをして解決。