-1

I'm having trouble getting the pg gem working with my rails app.

When I do a sudo bundle install I get:

Using rake (10.0.4)
Using i18n (0.6.4)
Using multi_json (1.7.2)
Using activesupport (3.2.8)
Using builder (3.0.4)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.6)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.22)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using coffee-script-source (1.6.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.8)
Using coffee-rails (3.2.2)
Using jquery-rails (2.2.1)
Using pg (0.15.0)
Using bundler (1.1.5)
Using rails (3.2.8)
Using sass (3.2.7)
Using sass-rails (3.2.6)
Using uglifier (1.3.0)

However, when I do a 'bundle show' for any gem, I get:

Could not find pg-0.15.0 in any of the sources

Additionally, when I do any rake command, I get:

/usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find pg-0.15.0 in any of the sources (Bundler::GemNotFound)
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.6/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.6/lib/rubygems-bundler/noexec.rb:60:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.6/lib/rubygems-bundler/noexec.rb:75:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
        from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:9:in `<main>'

I suspect that it has something to do with RVM and what version of Ruby I'm using since I recently changed to 1.9.3. Any ideas?

Ridwan
  • 367
  • 1
  • 6
  • 13
  • are you using user based rvm or common rvm? or no rvm? – Mohanraj Apr 03 '13 at 05:44
  • I don't know what the difference is between user based RVM and common RVM is. But, yes, I am using RVM. – Ridwan Apr 03 '13 at 05:46
  • user based RVM => ruby and all gems are installed in your home directory called .rvm. But in common rvm ruby and all gems installed in /usr/local/rvm, it may differ based on system. – Mohanraj Apr 03 '13 at 05:52
  • Please can you check do you have .rvm folder in your home directory? – Mohanraj Apr 03 '13 at 05:53
  • did you update rubygems and re installed bundler after upgrading to 1.9.3 I ran into a similar issue the other day had to reinstall rubygems and bundler – Abid Apr 03 '13 at 06:03
  • check this link it may be helpfull to you http://stackoverflow.com/questions/7228798/why-isnt-bundle-install-allowing-for-the-pg-gem-to-fully-install – shrikant1712 Apr 03 '13 at 07:17

1 Answers1

1

Try bundle install without sudo.

Igor Kapkov
  • 3,779
  • 2
  • 19
  • 19
  • This fails when installing pg with: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.3-p194/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) Also, I've checked to make sure libpq is installed. – Ridwan Apr 03 '13 at 05:47