I started off by downloading the PostgreSQL installer from the PostgreSQL website (I had also tried Postgres.app) and running through the installer with mostly default settings.
Once that was done I went to install the node-postgres module in my node project via 'npm install pg', this threw the following error:
gyp: Call to 'pg_config --libdir' returned exit status 127. while trying to load binding.gyp
After some searching I found this Github issue which pointed me to the solution. The problem is that the installer did not add the PostgreSQL binary folder to my PATH. To get around this, I updated my ~/.bash_profile (vim ~/.bash_profile is the easiest way to do this) to add the following line:
export PATH=/Library/PostgreSQL/9.3/bin:$PATH
(be sure to use the version of PostgreSQL you installed. Also, if you already have that line, you should just add '/Library/PostgreSQL/9.3/bin:' after PATH=)
Save that file, restart terminal and you should be able to type pg_config and get some output on your screen. Once you've done that, reinstall the node-postgres module and you should not see the error anymore.
Hope this helps!