How to wrangle the pg (postgresql) gem with macports and rvm

Seeing this?

Wondering how or where to get this mythical pg_config? It’s part of the PostgreSQL package. If you’re running MacPorts, it’s easy:

Then, following the instructions on the RVM website, run

Posted in Technical HOWTOs Tagged with: , , , ,
  • Mike Gauthier

    I ran into something similar when installing the mysql gem with rvm.  Here is what worked for me…

    gem install mysql — –with-mysql-dir=/usr/local/mysql –with-mysql-lib=/usr/local/mysql/lib –with-mysql-include=/usr/local/mysql/include

    I’ve also seen this work for mysql2:
    gem install mysql2 — –with-mysql-config=/path/to/bin/mysql_config

  • Jasdeep

    YOU ARE A LIFE SAVER!!!!!!!!! I’ve been running around like a clown for the last 3-4 hours to get pg gem installed on my Mac OS X but all attempts futile..! I feel like having a pint of beer with you at the moment and kissing you on the forehead!

    You the man!

  • Mathew

    Dude … I LOVE YOU LONG TIME!!! spent ages trying to sort this out .. and bang .. here’s the answer…

    Thanks a million!

  • lothar59

    i’m facing the same problem on Ubuntu, if anyone knows how to fix this…

  • lothar59

    ok just had to do sudo aptitude install libpq-dev then gem install pg

  • Salym Senyonga

    thanks man, this helped a ton

  • jan54

    I know you posted this a year ago but thanks this was driving me Crazy

  • dex

    (Y) thumbs up!