Ruby on rails 捆绑安装pg无法工作,mac os yosemite。我什么都试过了

Ruby on rails 捆绑安装pg无法工作,mac os yosemite。我什么都试过了,ruby-on-rails,ruby,postgresql,Ruby On Rails,Ruby,Postgresql,我有一个rails应用程序,我想开始工作,但我就是无法克服这个错误。我无法安装pg-v-0.10.1 gem,我尝试从整个系统重新安装Postgressql,但没有成功。我已尝试运行下面的命令,该命令运行成功,但仍无法成功运行bundle安装 env ARCHFLAGS="-arch x86_64" gem install pg 我只是不断收到下面的错误消息 `Building native extensions with: '--with-pg-config= /usr/local/bi

我有一个rails应用程序,我想开始工作,但我就是无法克服这个错误。我无法安装pg-v-0.10.1 gem,我尝试从整个系统重新安装Postgressql,但没有成功。我已尝试运行下面的命令,该命令运行成功,但仍无法成功运行bundle安装

env ARCHFLAGS="-arch x86_64" gem install pg 

我只是不断收到下面的错误消息

`Building native extensions with: '--with-pg-config= /usr/local/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config= /usr/local/bin/pg_config
Using config values from 
sh: : command not found
sh: : command not found
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/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-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}/
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
        --with-ms/libpqlib
        --without-ms/libpqlib
    enter code here

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.18.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.18.2/ext/gem_make.out`

您需要pg-dev库。试试这个:我已经试过不抽雪茄了。版本0.10.1是必要的吗?我想我现在使用的是0.18.0,这就是gem文件中的内容。所以它保留在gem文件中,然后是的。如果这是个问题,我愿意在Gemfile中更改版本。你认为版本是问题所在吗?你有本地安装的postgres吗?如果您的电脑在mac上,请查找名为
brew
的软件包管理器。安装postgres非常简单,只需
brew安装postgres
。之后尝试安装gem!希望这有帮助