2016-05-05 20 views
2

ich versuche pg (postgreSQL gem) auf meinem Mac zu installieren und diesen Fehler bekamlibpq native Erweiterung abgestürzt auf Ruby on Rails

Installing pg 0.18.1 with native extensions 

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /private/var/folders/h5/slvxw4xd0d30dxzxf8vg5c600000gp/T/bundler20160302-7420-1orffo8pg-0.18.1/gems/pg-0.18.1/ext 
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160302-7420-h4zq8h.rb extconf.rb 
    checking for pg_config... yes 
    Using config values from /usr/local/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/2.0/usr/bin/ruby 
    --with-pg 
    --without-pg 
    --enable-windows-cross 
    --disable-windows-cross 
    --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}/ 
    --with-pqlib 
    --without-pqlib 
    --with-libpqlib 
    --without-libpqlib 
    --with-ms/libpqlib 
    --without-ms/libpqlib 

    To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /var/folders/h5/slvxw4xd0d30dxzxf8vg5c600000gp/T/bundler20160302-7420-1orffo8pg-0.18.1/extensions/universal-darwin-15/2.0.0/pg-0.18.1/mkmf.log 

    extconf failed, exit code 1 

    Gem files will remain installed in /var/folders/h5/slvxw4xd0d30dxzxf8vg5c600000gp/T/bundler20160302-7420-1orffo8pg-0.18.1/gems/pg-0.18.1 for inspection. 
    Results logged to /var/folders/h5/slvxw4xd0d30dxzxf8vg5c600000gp/T/bundler20160302-7420-1orffo8pg-0.18.1/extensions/universal-darwin-15/2.0.0/pg-0.18.1/gem_make.out 

ich alle meine Pakete installiert So überprüfen:

Mac OS X El Capitan v10.11.3

$ruby -v 
-> ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15] 
$rails -v  
-> Rails 4.2.5.1 
$brew -v 
-> Homebrew 0.9.5 (git revision c9aee; last commit 2016-02-15) 
$benv -v 
-> rbenv 0.4.0 
$postgres -V  
-> postgres (PostgreSQL) 9.4.5 
$xcode-select -p 
/Applications/Xcode.app/Contents/Developer 
$gcc --version 
-> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
    Apple LLVM version 7.0.2 (clang-700.1.81) 
    Target: x86_64-apple-darwin15.3.0 
    Thread model: posix 

ich will nicht installiert postgre via Browser App-Download haben, ich will es über Gebräu-Paket, so gibt es eine Möglichkeit, die lästige libpq zu installieren?

+0

Mögliches Duplikat von [Die PostgreSQL-Client-Bibliothek (libpq) kann nicht gefunden werden] (http://StackOverflow.com/questions/6209797/cant-find-the-postgresql-client-Library-Libpq) – BoraMa

Antwort

0

Sie sollten libpq nicht für Postgres benötigen, um mit Ruby unter Mac OSX zu arbeiten.

Wenn Sie Postgres mit Postgres.app installiert, sould Sie in der Lage sein, es zu entfernen, indem einfach postgres.app in den Papierkorb verschieben und das Datenverzeichnis von ~/Library/Application Support/Postgres löschen (nur, wenn Sie alle vorhandenen Postgres-Datenbanken auf Ihrem Computer löschen möchten)

Dann, mit Homebrew, installieren Sie Postgres via brew install postgresql. Der Edelstein pg sollte direkt mit der Homebrew-Installation von Postgres funktionieren.

+0

Mein Laptop ist rein neu, es gibt irgendwelche datenbanken, und ich habe postgre nicht per app installiert, ich habe es über bre install postgresql und wenn ich versuche, ein neues rails-projekt zu starten ... boom !! Alles abgestürzt wegen der libpq: S –