unable to install pg gem

后端 未结 20 784
不知归路
不知归路 2020-12-02 04:54

I tried using gem install pg but it doesn\'t seem to work.

gem install pg gives this error

Temporarily enhancing PATH to in         


        
相关标签:
20条回答
  • 2020-12-02 05:00

    gem install pg -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config

    0 讨论(0)
  • 2020-12-02 05:01

    I'd this issue on Linux Mint (Maya) 13, And I fixed it by Installing postgresql and postgresql-server :

    apt-get install postgresql-9.1 
    
    sudo apt-get install postgresql-server-dev-9.1
    
    0 讨论(0)
  • 2020-12-02 05:01

    I had to do this on CentOS 5.8. Running bundle install kept causing issues since I couldn't force it to use a particular PG version.

    I can't yum erase postgresql postgresql-devel either, because of dependency issues (it would remove php, http etc)

    The solution? Mess $PATH temporarily to give preference to the update pgsql instead of the default one:

    export PATH=/usr/pgsql-9.2/bin:$PATH
    bundle install
    

    Basically, with the above commands, it will look at /usr/pgsql-9.2/bin/pg_config before the one in /usr/bin/pg_config

    0 讨论(0)
  • 2020-12-02 05:04

    If you are using Postgres.app on Mac, you may resolve this issue once and for all like this:

    First gem uninstall pg, then edit your ~/.bash_profile or ~/.zshrc file or equivalent and add:

    # PostgreSQL bin path
    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
    

    Then bundle install and gem install pg should both work as expected.

    0 讨论(0)
  • 2020-12-02 05:08

    Answered here: Can't install pg gem on Windows

    There is no Windows native version of latest release of pg (0.10.0) released yesterday, but if you install 0.9.0 it should install binaries without issues.

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

    On Mac brew install postgres THEN bundle install

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