pg gem '0.14.0' on Mountain Lion fails

后端 未结 10 1893
孤街浪徒
孤街浪徒 2020-12-10 12:56

I just upgraded from OS X Lion to OS X Mountain Lion. My rails environment for the most part stayed in tact.

The only steps I had to do to get things back to a good

相关标签:
10条回答
  • 2020-12-10 13:00

    Fro those, who are using Kubuntu 13.04 and installed pg with one click tool, pg config is in other folder, so command:

    gem install pg -- --with-pg-config=/opt/PostgreSQL/9.3/bin/pg_config
    
    0 讨论(0)
  • 2020-12-10 13:01

    The issue is the location of pg_config. If you use the one-click installer, it is in /Library/PostgreSQL/9.2/bin/pg_config, so this will build your gem just fine:

    env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Library/PostgreSQL/9.2/bin/pg_config

    0 讨论(0)
  • 2020-12-10 13:03

    Reinstalling ruby fixed a similar issue I was having after upgrading to Mountain Lion

    rvm reinstall 1.9.3
    

    Note: also run the following as it seems the default version resets

    rvm --default 1.9.3
    

    For reference I posted the error I was seeing below

    gem install pg
    Building native extensions.  This could take a while...
    ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.
    
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with pg=/usr/local/Cellar/postgresql/9.1.4/bin
    checking for pg_config... yes
    Using config values from /usr/local/bin/pg_config
    checking for libpq-fe.h... no
    Can't find the 'libpq-fe.h header
    *** extconf.rb failed ***
    
    0 讨论(0)
  • 2020-12-10 13:04

    I was able to get it to work by installing the Postgres.app from Heroku and removing my existing postgresql installation. You can download the app here:

    http://postgresapp.com/

    brew remove postgresql
    
    bundle install
    

    If you didn't use brew, here's a link to more uninstall docs from Postgres.app

    http://postgresapp.com/documentation#toc_16

    0 讨论(0)
  • 2020-12-10 13:05

    I had the exact same issue; same stack trace as you've posted.

    MRI 1.9.3-p286 / OS X 10.8.2 / Postgres 9.0.4 with homebrew.

    I solved it by simply doing:

    $ brew update
    $ brew upgrade postgresql
    $ bundle
    

    Hope it works for someone else.

    0 讨论(0)
  • 2020-12-10 13:06

    Mac comes with an outdated prebuilt PostgreSQL client installation and pg_config file that comes with it conflicts with any new PostgreSQL server & client installations.

    Installing ruby gem with a fully qualified file name of pg_config overrides default known location of pg_config and installation succeeds.

    Current location of pg_config by one click installer by EnterpriseDB: /Library/PostgreSQL/bin/pg_config

    This command finally worked for me.

    CrashMX2$ gem install pg -- --with-pg-config=/Library/PostgreSQL/bin/pg_config

    0 讨论(0)
提交回复
热议问题