Can't find the 'libpq-fe.h header when trying to install pg gem

前端 未结 30 1895
深忆病人
深忆病人 2020-11-22 07:47

I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg gem. It gives me the following error:



        
30条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 08:23

    I could solve this in another way. I didn't find the library on my system. Thus I installed it using an app from PostgreSQL main website. In my case (OS X) I found the file under /Library/PostgreSQL/9.1/include/ once the installation was over. You may also have the file somewhere else depending on your system if you already have PostgreSQL installed.

    Thanks to this link on how to add an additional path for gem installation, I could point the gem to the lib with this command:

    export CONFIGURE_ARGS="with-pg-include=/Library/PostgreSQL/9.1/include/"
    gem install pg
    

    After that, it works, because it now knows where to find the missing library. Just replace the path with the right location for your libpq-fe.h

提交回复
热议问题