NB: this works on 64b versions of R; I tested it with the R64 app with R version 2.10.1 on Snow Leopard
Step by step instructions for talking to Postgres or Greenplum:
- install macports
- install postgres; I used 8.4 via
sudo port install postgresql84
- in a shell, create an environmental variable
PG_CONFIG
pointing to thepg_config
binary installed by postgres. In my installation, this is something likeexport PG_CONFIG=/opt/local/lib/postgresql84/bin/pg_config
- in the same shell, tell
R
to install the RPostgreSQL package from source, ie> install.packages('RPostgreSQL', type='source')
- test the installation works:
1 2 3 4 5 6 7 |
|
Diagnosing error messages / problems:
- If R says
1 2 |
|
you must specify to install the package from source, as above with type='source'
* If you get compilation errors when installing the package that mention libpq-fe.h
, then R can’t find pg_config
* if the package installs but when loading it you get errors involving missing symbol _PQbackendPID then you are mixing 32 and 64 bit software.
Follow the links for instructions to fix your problems.