Ruby on rails 安装ruby gems时无法创建Makefile

Ruby on rails 安装ruby gems时无法创建Makefile,ruby-on-rails,ruby,makefile,gem,osx-mountain-lion,Ruby On Rails,Ruby,Makefile,Gem,Osx Mountain Lion,我正在运行OSX 10.8.2,Xcode是用命令行工具安装的 我正在尝试捆绑,在一些gem(我将在底部指定)上,我得到以下信息: ERROR: Failed to build gem native extension 到目前为止,我在调用方的gem'pg'和gem'binding' 我相信这个错误与无法创建Makefile有关,但是找不到任何有助于解决这个错误的方法。我已将完整错误粘贴到下面: 我不知如何是好 Gem::Installer::ExtensionBuildError: ERR

我正在运行OSX 10.8.2,Xcode是用命令行工具安装的

我正在尝试捆绑,在一些gem(我将在底部指定)上,我得到以下信息:

ERROR: Failed to build gem native extension

到目前为止,我在调用方的
gem'pg'
gem'binding'

我相信这个错误与无法创建Makefile有关,但是找不到任何有助于解决这个错误的方法。我已将完整错误粘贴到下面:

我不知如何是好

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib


Gem files will remain installed in /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1 for inspection.
Results logged to /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.
编辑:我正在使用
rbenv
管理ruby版本,它说我正在运行
1.9.3-p385
系统ruby是一个较旧的版本,但据我所知,这并不重要

我已通过
自制

编辑2:

我尝试切换到
RVM
进行ruby管理,但遇到另一个错误:

Error running 'make -j2', please read ... ruby-1.9.3-p385/make.log
There has been an error while running make. Halting the installation.

文件make.log不存在

您需要安装postgres。您需要:

  • Ruby 1.8.7-p249或1.9.3-p0
  • PostgreSQL 8.3.x(带有标题,-开发包等)
如果您使用的是brew,只需

brew install postgresql

至于绑定调用方,您使用的是什么版本的ruby?

您需要安装postgres。您需要:

  • Ruby 1.8.7-p249或1.9.3-p0
  • PostgreSQL 8.3.x(带有标题,-开发包等)
如果您使用的是brew,只需

brew install postgresql

至于绑定调用方,您使用的是什么版本的ruby?

所以我通过执行安装了pg的
sudo env ARCHFLAGS=“-arch x86_64”gem install pg
解决了这个问题,但现在我在尝试创建数据库、运行服务器时遇到了不同的问题,等等。我将为这些问题创建另一个问题。

因此我通过执行安装了pg的
sudo env ARCHFLAGS=“-arch x86_64”gem install pg
解决了这个问题,但现在我在尝试创建数据库、运行服务器时遇到了不同的问题,等等。我将为这些问题创建另一个问题。

rbenv说我正在使用ruby版本1.9.3 p-385,我在我的另一台机器上使用它没有问题。我刚刚做了brew安装postgresql并安装了它。我在尝试绑定gem文件中的pg gem时仍然会遇到相同的错误。当我尝试用sudo gem install安装gem时,我也会遇到同样的错误。我只需键入bundle或bundle install。另外,请参阅对我的问题的编辑谢谢你的帮助。rbenv说我使用的是ruby版本1.9.3 p-385,我在另一台机器上使用它没有问题。我刚刚做了brew安装postgresql并安装了它。我在尝试绑定gem文件中的pg gem时仍然会遇到相同的错误。当我尝试使用sudo gem install安装gem时,我也会遇到同样的错误。我只需键入bundle或bundle install。另外,请参阅对我问题的编辑。谢谢你的帮助。确认,我本打算提出这个建议,但我认为这不是你的问题。Sorryack,我本来想建议的,但我想这不是你的问题。很抱歉