PostgreSQL gem for rails won't install, even when both home brew and app are installed PostgreSQL gem for rails won't install, even when both home brew and app are installed ruby ruby

PostgreSQL gem for rails won't install, even when both home brew and app are installed


At the end of the day it was:

ARCHFLAGS="-arch x86_64" bundle install

that worked for me.

reason being:

by default it tries to compile a universal binary, which apparently fails... so that environment variable makes it only compile the x86 version which is all you need

you can add this line to your ~/.profile or similar: export ARCHFLAGS="-arch x86_64"

For further reading see: This README for OSX


Make sure Postgres is installed on your computer first

for Ubuntu systems: sudo apt-get install libpq-devon RHEL systems: yum install postgresql-develfor Mac: brew install postgresql

Then run bundle install


I used these commnads of this link

rails 4.2.0: can't install pg gem on ubuntu 14.04

You need install the postgreSQL dev package with header of PostgreSQL

sudo apt-get install libpq-dev

You may also try

sudo apt-get install postgresql-client

sudo apt-get install postgresql postgresql-contrib