How to fix the installation problem of the module "pg" for Node in Mac OS X
When you issue npm install pg command to instal pg package for Node on your Mac OS X, you might get an error like this
"...error: The program ['pg_config'] is required"
Error simply implies that pg installation cannot find pg_config file.
Solution
1. First make sure you installed PostgreSQL.
2. Find the path to your pg_config file. In my case it is /Library/PostreSQL/8.4/bin/pg_config
3. Open the Terminal and enter the following commands one by one
PG_CONFIG=/Library/PostreSQL/8.4/bin/pg_config
export PG_CONFIG
npm install pg