Can't find the PostgreSQL client library (libpq)

When i try it start my ruby server i get a error that looks like

rails server Could not find pg-0.12.2 in any of the sources
Run bundle install to install missing gems.

I dont know what to do
Thanks for all the help

On Wed, Mar 7, 2012 at 9:11 PM, moises zaragoza [email protected]
wrote:

When i try it start my ruby server i get a error that looks like

rails server Could not find pg-0.12.2 in any of the sources
Run bundle install to install missing gems.

What happens when you do what the command says:

$ bundle install

Do you have a Gemfile ? You might show it here.

HTH,

Peter

Seems that you are on a Mac

If you installed Postgres on your system using the binaries downloaded
directly from postgresql.org website, the following should fix this
issue…

PATH=$PATH:/Library/PostgreSQL/9.0/bin sudo gem install pg

Craig

On Mar 7, 2012, at 2:03 PM, moises zaragoza wrote:

Using activemodel (3.1.3)
Using polyglot (0.3.3)
Using rdoc (3.12)
Using annotate (2.4.1.beta1)
Using cocaine (0.2.1)
Using factory_girl (2.5.0)
Using guard-livereload (0.4.0)
Using libv8 (3.3.10.4)
Using config values from /usr/local/bin/pg_config

–curdir
–without-pg-config
Gem files will remain installed in

acts_as_list (0.1.4)
chronic (0.6.7)
eventmachine (0.12.10)
guard-sass (0.5.4)
linecache (0.46)
rack-test (0.6.1)
ruby-progressbar (0.0.10)
treetop (1.4.10)
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Craig W. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
www.ttiassessments.com

Need help communicating between generations at work to achieve your
desired success? Let us help!

On Wed, Mar 7, 2012 at 4:10 PM, Craig W. [email protected]
wrote:

When i do bundle install i get
Using erubis (2.7.0)
Using treetop (1.4.10)
Using thor (0.14.6)
Using authlogic (3.1.0)
Using coffee-script-source (1.2.0)
Using factory_girl_rails (1.6.0)
Using guard-rails (0.0.3)
Using rbx-require-relative (0.0.5)
checking for libpq-fe.h… yes
Provided configuration options:
–ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
–with-pg_config
/Users/moiseszaragoza/.bundler/tmp/37599/gems/pg-0.12.2 for inspection.
*** LOCAL GEMS ***
addressable (2.2.6)
cocaine (0.2.1)
execjs (1.3.0, 1.2.13)
guard-spork (0.5.1)
mail (2.4.3, 2.3.0)
rails (3.2.2, 3.1.3)
rubygems-update (1.8.17)
tzinfo (0.3.32, 0.3.31)
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

you can type pg_config at the prompt to see environment variable
setting if it’s in your path, otherwise do a find to locate the
binary:

sudo updatedb
locate pg_config

you can use grep to narrow down the search

locate pg_config | grep bin

on my linux box, I use something like the following to install gem pg

sudo gem install pg – --with-pg-config=/usr/local/pgsql/bin/pg_config

you may need to install the header files if you if you installed
postgresql using your system package. I personally just build
postgresql from source, which is something you may want to look into
if you feel comfortable with this


Kind Regards,
Rajinder Y.

SafetyNet Test Driven Development
http://safetynet.devmentor.org

On Mar 7, 2012, at 2:10 PM, Craig W. wrote:

If you installed Postgres on your system using the binaries downloaded directly
from postgresql.org website, the following should fix this issue…

Point of clarification: there are no Mac binaries available directly
from postgresql.org. The are 3 links there which all lead to external
sites with installers maintained external to the postgres project, which
are built with who knows what options, and installed into unusual
locations.

Also, ./configure, make, make install work perfectly well on OS X.


Scott R.
[email protected]
http://www.elevated-dev.com/
(303) 722-0567 voice

When i do bundle install i get

$ bundle install
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system:
Using rake (0.9.2.2)
Using multi_json (1.0.4)
Using activesupport (3.1.3)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.3)
Using erubis (2.7.0)
Using rack (1.3.6)
Using rack-cache (1.1)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.3)
Using actionpack (3.1.3)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.3)
Using arel (2.2.1)
Using tzinfo (0.3.31)
Using activerecord (3.1.3)
Using activeresource (3.1.3)
Using bundler (1.0.22)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.1.3)
Using rails (3.1.3)
Using acts-as-taggable-on (2.2.1)
Using acts_as_commentable (3.0.1)
Using acts_as_list (0.1.4)
Using addressable (2.2.6)
Using chosen-rails (0.9.5) from
git://github.com/fatfreecrm/chosen-rails.git (at master)
Using ajax-chosen-rails (0.1.5)
Using annotate (2.4.1.beta1)
Using authlogic (3.1.0)
Using awesome_print (1.0.2)
Using nokogiri (1.5.0)
Using ffi (1.0.11)
Using childprocess (0.3.1)
Using rubyzip (0.9.6.1)
Using selenium-webdriver (2.19.0)
Using xpath (0.1.4)
Using capybara (1.1.2)
Using chronic (0.6.7)
Using cocaine (0.2.1)
Using coffee-script-source (1.2.0)
Using execjs (1.2.13)
Using coffee-script (2.2.0)
Using coffee-rails (3.1.1)
Using columnize (0.3.6)
Using daemons (1.1.5)
Using database_cleaner (0.7.1)
Using diff-lcs (1.1.3)
Using eventmachine (0.12.10)
Using em-websocket (0.3.6)
Using factory_girl (2.5.0)
Using factory_girl_rails (1.6.0)
Using ffaker (1.12.1)
Using rspec-core (2.8.0)
Using rspec-expectations (2.8.0)
Using rspec-mocks (2.8.0)
Using rspec (2.8.0)
Using rspec-instafail (0.1.9)
Using ruby-progressbar (0.0.10)
Using fuubar (0.0.6)
Using guard (0.10.0)
Using guard-livereload (0.4.0)
Using guard-rails (0.0.3)
Using guard-rspec (0.6.0)
Using sass (3.1.12)
Using guard-sass (0.5.4)
Using spork (0.8.5)
Using guard-spork (0.5.1)
Using haml (3.1.4)
Using headless (0.2.2)
Using jquery-rails (1.0.19)
Using kgio (2.7.0)
Using libv8 (3.3.10.4)
Using rbx-require-relative (0.0.5)
Using linecache (0.46)
Using paperclip (2.5.2)
Installing pg (0.12.2) with native extensions
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/local/bin/pg_config
checking for libpq-fe.h… yes
checking for libpq/libpq-fs.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/someuser/.bundler/tmp/37599/gems/pg-0.12.2 for inspection.
Results logged to
/Users/someuser/.bundler/tmp/37599/gems/pg-0.12.2/ext/gem_make.out
An error occured while installing pg (0.12.2), and Bundler cannot
continue.
Make sure that gem install pg -v '0.12.2' succeeds before bundling.

=================== MY GEM LIST

*** LOCAL GEMS ***

actionmailer (3.2.2, 3.1.3)
actionpack (3.2.2, 3.1.3)
activemodel (3.2.2, 3.1.3)
activerecord (3.2.2, 3.1.3)
activeresource (3.2.2, 3.1.3)
activesupport (3.2.2, 3.1.3)
acts-as-taggable-on (2.2.1)
acts_as_commentable (3.0.1)
acts_as_list (0.1.4)
addressable (2.2.6)
ajax-chosen-rails (0.1.5)
annotate (2.4.1.beta1)
arel (3.0.2, 2.2.1)
authlogic (3.1.0)
awesome_print (1.0.2)
builder (3.0.0)
bundler (1.0.22)
capybara (1.1.2)
childprocess (0.3.1)
chronic (0.6.7)
cocaine (0.2.1)
coffee-rails (3.2.2, 3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
columnize (0.3.6)
daemons (1.1.5)
database_cleaner (0.7.1)
diff-lcs (1.1.3)
em-websocket (0.3.6)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.3.0, 1.2.13)
factory_girl (2.5.0)
factory_girl_rails (1.6.0)
ffaker (1.12.1)
ffi (1.0.11)
fuubar (0.0.6)
guard (0.10.0)
guard-livereload (0.4.0)
guard-rails (0.0.3)
guard-rspec (0.6.0)
guard-sass (0.5.4)
guard-spork (0.5.1)
haml (3.1.4)
headless (0.2.2)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.1, 1.0.19)
json (1.6.5)
kgio (2.7.0)
libv8 (3.3.10.4 x86_64-darwin-11)
linecache (0.46)
mail (2.4.3, 2.3.0)
mime-types (1.17.2)
multi_json (1.1.0, 1.0.4)
nokogiri (1.5.0)
paperclip (2.5.2)
polyglot (0.3.3)
rack (1.4.1, 1.3.6)
rack-cache (1.2, 1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.2, 3.1.3)
railties (3.2.2, 3.1.3)
rake (0.9.2.2)
rbx-require-relative (0.0.5)
rdoc (3.12)
rspec (2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
rspec-instafail (0.1.9)
rspec-mocks (2.8.0)
ruby-progressbar (0.0.10)
rubygems-update (1.8.17)
rubyzip (0.9.6.1)
sass (3.1.15, 3.1.12)
sass-rails (3.2.4)
selenium-webdriver (2.19.0)
spork (0.8.5)
sprockets (2.1.2, 2.0.3)
sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.32, 0.3.31)
uglifier (1.2.3)
xpath (0.1.4)

On Mar 8, 2012, at 7:17 AM, Scott R. wrote:

On Mar 7, 2012, at 2:10 PM, Craig W. wrote:

If you installed Postgres on your system using the binaries downloaded directly
from postgresql.org website, the following should fix this issue…

Point of clarification: there are no Mac binaries available directly from
postgresql.org. The are 3 links there which all lead to external sites with
installers maintained external to the postgres project, which are built with who
knows what options, and installed into unusual locations.

Also, ./configure, make, make install work perfectly well on OS X.


sorry - you’re correct - it was the one-click installer from
EnterpriseDB site.

Craig

If you are getting the following issue in Mac M1 pro, Silicon chip

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)

Solution:

Install libpq via homebrew and add it to the PATH

brew install libpq
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
OR ~/bash_profile instead of ~/.zshrc if you use that.

Now try

bundle install # OR
gem install pg

This works for me.