Sinatra / Rack / Bundler应用程序无法安装postgres gem

时间:2014-01-13 00:42:57

标签: postgresql gem sinatra bundler rubymine

我正在尝试在我的rack / bundler应用程序中安装postgres gem“pg”,并在尝试通过RubyMine安装时继续失败。

Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.5) 
Using bcrypt-ruby (3.1.2) 
Using data_objects (0.10.13) 
Using dm-core (1.2.1) 
Using dm-aggregates (1.2.0) 
Using dm-constraints (1.2.0) 
Using dm-migrations (1.2.0) 
Using fastercsv (1.5.5) 
Using json (1.8.1) 
Using json_pure (1.8.0) 
Using multi_json (1.8.2) 
Using dm-serializer (1.2.2) 
Using dm-timestamps (1.2.0) 
Using dm-transactions (1.2.0) 
Using stringex (1.5.1) 
Using uuidtools (2.1.4) 
Using dm-types (1.2.2) 
Using dm-validations (1.2.0) 
Using datamapper (1.2.0) 
Using dm-do-adapter (1.2.0) 
Installing do_postgres (0.10.13) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb 
checking for main() in -lpq... yes
checking for libpq-fe.h... no
*** 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/adam419/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
    --with-pgsql-server-dir
    --without-pgsql-server-dir
    --with-pgsql-server-include
    --without-pgsql-server-include=${pgsql-server-dir}/include
    --with-pgsql-server-lib
    --without-pgsql-server-lib=${pgsql-server-dir}/
    --with-pgsql-client-dir
    --without-pgsql-client-dir
    --with-pgsql-client-include
    --without-pgsql-client-include=${pgsql-client-dir}/include
    --with-pgsql-client-lib
    --without-pgsql-client-lib=${pgsql-client-dir}/
    --with-pqlib
    --without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created


Gem files will remain installed in /Users/adam419/.rvm/gems/ruby-2.0.0-p195@global/gems/do_postgres-0.10.13 for inspection.
Results logged to /Users/adam419/.rvm/gems/ruby-2.0.0-p195@global/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.13), and Bundler cannot
continue.
Make sure that `gem install do_postgres -v '0.10.13'` succeeds before bundling.

因此,出于某种原因,对于我当前的项目,如果我通过命令行安装gem,它就不会被添加到Rubymine中的External Libraries文件夹中,并且到目前为止依赖于它自己的bundle / gem安装程序。因此,通过阅读其他问题,我看到下载Postgres93对Mac OS x的支持,并在命令行中我试图通过指定pg_config文件的路径来安装postgres gem,并且它已成功下载,但没有添加到Rubymine项目中的图书馆。

sudo gem install pg -- --with-pg config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

上面的命令有效,但没有导致gem出现在Rubymine中,因此我仍然无法推送到Heroku。因此,当尝试向bundle安装程序提供其他参数时,我在输入

时会出现语法错误
--with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

有任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:-1)

解决方案 - 使用自制软件重新安装Postgresql