2

Possible Duplicate:
Unable to install pg gem on ubuntu - Can’t find the 'libpq-fe.h header

Whenever I try to install the pg gem for my Rails project, it gives me Error "failed to build native extensions".

I already used a couple of tricks but failed.

Community
  • 1
  • 1
Muhammad Ateq Ejaz
  • 1,845
  • 20
  • 22

4 Answers4

2

Try this:

$ sudo apt-get install ruby-dev build-essential

or:

$ sudo apt-get install postgresql-client libpq5 libpq-dev

then:

$ sudo gem install pg
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Dipak Panchal
  • 5,996
  • 4
  • 32
  • 68
1

This is a traditional problem if you are installing the pg gem for Rails and getting this error.

Run the following commands on your terminal:

  1. mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm
  2. gem install pg -v '0.14.1'
  3. mv ~/.rvm/usr/lib_rvm ~/.rvm/usr/lib
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Muhammad Ateq Ejaz
  • 1,845
  • 20
  • 22
0

Edit your Gemfile and add gem pg to the file. It will make sense to also comment out the gem sqlite3 instead.

Save the file and then issue the bundle install command.

tokhi
  • 21,044
  • 23
  • 95
  • 105
  • 1
    SQLite3 is not a replacement for PostgreSQL. [See here](http://www.postgresql.org/about/) – nurettin Oct 30 '12 at 05:58
  • @pwned: thanks for the comment. You are right, if we compare the capabilities of both then PostgreSQL wins http://database-management-systems.findthebest.com/compare/43-53/PostgreSQL-vs-SQLite. I thought the user might want to use only one DBMS for data storage. – tokhi Oct 30 '12 at 07:10
0

Try with this. It will work..

sudo apt-get install postgresql-8.4

sudo apt-get install pgadmin3

vijikumar
  • 1,805
  • 12
  • 16