我在小牛队中安装了postrgres应用程序。它在5432端口上运行。
我有一个使用pg gem的rails项目。
然而,当运行"捆绑安装"我收到这个错误:
Installing pg (0.17.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/jonathanhurley/.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 ***
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.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/jonathanhurley/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
Gem files will remain installed in /Users/jonathanhurley/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.1 for inspection.
Results logged to /Users/jonathanhurley/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.1/ext/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
如果没有安装postgres但我确实理解了这个错误。
答案 0 :(得分:2)
我建议首先安装Homebrew,因为它是OS X的一个很好的包管理器。您可以使用以下命令安装它:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
安装完homebrew后,可以使用brew
命令安装postgresql。
brew install postgresql
我的同事遇到了与昨天相同的问题,但在使用自制软件再次安装后,它按预期工作。