rails - postgres error: Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later,

后端 未结 5 1423
遇见更好的自我
遇见更好的自我 2020-12-16 18:38

I am stuck with the setup of Ruby (1.9.3), Rails and Postgres (9.0.8) on my Mac (10.6.8). Everytime when I run rails console I get the following error:

相关标签:
5条回答
  • 2020-12-16 18:58

    In one project this solution ("gem install & uninstall pg") was fine.

    But in another project, that uses the same rails and Postgres version, I had to be explicit with version in gemfile to make it work:

      gem 'pg', '0.14.1'
    
    0 讨论(0)
  • 2020-12-16 19:14

    Found a solution here that worked for me: https://github.com/PostgresApp/PostgresApp/issues/109

    0 讨论(0)
  • 2020-12-16 19:17

    I ran into this also, but was able to fix it following the instructions on python pip install psycopg2 install error.

    First, make sure you have the most recent version of OpenSSL installed:

    MacBook Pro:~> openssl version -a
    OpenSSL 1.0.0c 2 Dec 2010
    built on: Mon Jan  3 17:26:21 PST 2011
    platform: darwin64-x86_64-cc
    options:  bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) idea(int) blowfish(idx) 
    compiler: /usr/bin/gcc-4.2 -fPIC -fno-common -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall
    OPENSSLDIR: "/opt/local/etc/openssl"
    

    ...and note the OPENSSLDIR. On my system, it's in /opt/local/, because I installed it via MacPorts. I just needed to update the symlinks in /usr/lib/ for libssl.dylib and libcrypto.dylib so that they pointed to the correct versions in /opt/local/lib instead of the old version in usr/lib:

    MacBook Pro:~> ls -la /usr/lib/libssl.dylib 
    lrwxr-xr-x  1 root  wheel  33 Aug 17 12:25 /usr/lib/libssl.dylib -> /opt/local/lib/libssl.1.0.0.dylib
    MacBook Pro:~> ls -la /usr/lib/libcrypto.dylib 
    lrwxr-xr-x  1 root  wheel  36 Aug 17 12:28 /usr/lib/libcrypto.dylib -> /opt/local/lib/libcrypto.1.0.0.dylib
    

    You can create the links by using the ln command:

    sudo ln -s /path/to/postgres/install/lib/libcrypto.dylib /usr/lib/libcrypto.dylib
    sudo ln -s /path/to/postgres/install/lib/libssl.dylib /usr/lib/libssl.dylib
    
    0 讨论(0)
  • 2020-12-16 19:18

    Symlinking the files as above didn't work for me. pg would always look at libssl-0.9.8.dylib.

    This question contains the right answer it seems: gem install pg --with-pg-config works, bundle fails

    It boils down to

    bundle config build.pg --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config

    (or whichever pg you are targeting)

    followed by gem uninstall pg and then bundle install

    0 讨论(0)
  • 2020-12-16 19:18

    Install new PostgreSQL version (i've used homebrew)

    brew install postgres
    

    Then reinstall the gem pg:

    gem uninstall pg
    gem install pg
    

    Hope it helps.

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