0

我有 OSX 10.6.8 并试图在我的设备上安装 PostgreSQL 9.2。我使用了他们网站上提供的图形安装程序,并设置了软件,最后没有使用堆栈构建器来额外配置其他功能。

当我加载 Rails 文件bundle install时遇到以下错误:

Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0) 
Using i18n (0.6.4) 
Using minitest (4.7.5) 
Using multi_json (1.7.7) 
Using atomic (1.1.10) 
Using thread_safe (0.1.0) 
Using tzinfo (0.3.37) 
Using activesupport (4.0.0) 
Using builder (3.1.4) 
Using erubis (2.7.0) 
Using rack (1.5.2) 
Using rack-test (0.6.2) 
Using actionpack (4.0.0)  
Using formatador (0.2.4) 
Using rb-fsevent (0.9.3) 
Using rb-inotify (0.9.0) 
Using rb-kqueue (0.2.0) 
Using listen (1.2.2) 
Using lumberjack (1.0.4) 
Using method_source (0.8.1) 
Using slop (3.4.5) 
Using pry (0.9.12.2) 
Using guard (1.8.1) 
Using rspec-core (2.13.1) 
Using rspec-expectations (2.13.0) 
Using turbolinks (1.2.0) 
Using jquery-turbolinks (1.0.0) 
Using jquery-ui-rails (4.0.3) 
Using json (1.8.0) 
Using kaminari (0.14.1) 
Using nested_form (0.3.2) 
Installing pg (0.15.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p448/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
--without-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=/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p448/gems/pg-0.15.1     for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p448/gems/pg-0.15.1/ext/gem_make.out

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

我已经尝试过gem install pg -- --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config,我得到的所有错误消息建议以及这里的解决方案。我还尝试重新安装 Postgres,找到适当的配置路径,并找到错误消息提到的 mfmk.log 文件(但该文件在我的计算机上不存在)。此外,在我的应用程序/PostgreSQL 下,有一个“重新加载配置”应用程序,当我运行时,它会显示Server signaled.

有谁知道我应该怎么做?我打算尝试 Homebrew,但我发现安装程序本身无法生成正常运行的软件很奇怪。

4

1 回答 1

1

如果您使用的是 Mac,请尝试:

ARCHFLAGS="-arch x86_64" gem install pg

这对我有用(brew安装程序告诉我这个......必须爱brew)

于 2013-12-12T08:51:59.513 回答