Installing PG gem under OS X when Bundle install fails

The other day a coworker ran into an issue installing the postgres gem on her laptop while doing a bundle install. I have ran into the issue a couple of times myself and its a quick fix however the first time I encountered it it took a few minutes longer than it probably should to figure out.


This is a pretty simple fix, first we need to ensure that you have postgres installed. You can download and install postgres here:

After that is installed, simple locate your pg_config file (an alernative would be to do a (find / -type d -name “pg_config”) although this may take a while. You could also do which psql91 (or whatever version you have installed) and look at the symlink in that directory. Generally your install should be in /opt/local/lib/.

What we are looking for is the pg_config directory we simply install the gem manually by running the below.

And there we go installed and a bundle install should now complete without issue.

Leave a Reply

Your email address will not be published. Required fields are marked *