`gem install pg` が失敗するときの対処法
pg
をインストールしようとすると次のような結果となる
$ gem install pg -v '0.18.4'
Fetching: pg-0.18.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
...
ログを眺めてみるとこんな内容が書かれている
clang -E -I/usr/local/Cellar/ruby/2.3.1/include/ruby-2.3.0/x86_64-darwin15 -I/usr/local/Cellar/ruby/2.3.1/include/ruby-2.3.0/ruby/
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^
1 error generated.
libpq-fe.h
が見当たらないらしい。
次のコマンドで postgresql をインストールすることで解決。
brew install postgresql
ちなみに、yumとかapt-getとか使ってる場合は次のコマンドを使えばいいらしい
(動作未確認...)
yum install postgresql-devel
apt-get install libpq-dev
Author And Source
この問題について(`gem install pg` が失敗するときの対処法), 我々は、より多くの情報をここで見つけました https://qiita.com/tdrk/items/812e7ea763080e147757著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .