Why can't I install PostGreSQL on my Mac?
Question
I'm trying to install PostGreSQL on my Mac (Mac OS 10.6.8 Snow Leopard) and I keep getting this error:
$ npm install pg
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/1.0.7
npm http 304 https://registry.npmjs.org/generic-pool/1.0.7
> pg@0.6.9 install /Users/omegatai/node_modules/pg
> node-waf configure build || (exit 0)
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local/lib/node
Checking for node prefix : ok /usr/local
Checking for program pg_config : not found
/Users/omegatai/node_modules/pg/wscript:16: error: The program ['pg_config'] is required
pg@0.6.9 ./node_modules/pg
└── generic-pool@1.0.7
What is pg_config? How can I fix this issue? Thanks!
Solution
The pg_config
program is normally installed as part of the PostgreSQL server installation. On the other hand, you appear to be installing a client library which expects that a server is already installed.
Head over to http://www.postgresql.org/ and install the PostgreSQL server first.
OTHER TIPS
Did you install PostgreSQL before installing pg? I guess not.
pg_config provides build time configuration of PostgreSQL. If you installed PostgreSQL binary, you should have it somewhere in the excutable file path. run
which pg_config
to reveal the absolute path of the program. I forgot whether Snow Leopard have it or not, but Lion does have it as /usr/bin/pg_config.
I guess you haven't installed the PostgreSQL or haven't configured your PATH variable correctly.