How to install RPostgreSQL on OSX Mavericks

Even if you’ve installed the PostgreSQL client binaries via Brew (i.e., brew install postgres), you will run into problems if you try to install the RPostgreSQL package in the usual way, i.e. install.packages('RPostgreSQL') from the R console. That’s simply because there are no binaries on CRAN for Mavericks. If you look at http://cran.r-project.org/web/checks/check_results_RPostgreSQL.html you’ll see that OSX Mavericks is the only flavor that runs into problems building the package.

Fortunately the solution is trivial. Install it from source, and yes, this sounds way scarier than it really is.

Download the source tarball from http://cran.r-project.org/web/packages/RPostgreSQL/index.html. Now resist for a moment the urge to untar the file. Instead, install first the DBI package from the R console:

install.packages('DBI')

and then run this from the directory where you downloaded the tarball:

sudo R CMD INSTALL RPostgreSQL_0.4.tar.gz

And you’re ready to go.

How to install RPostgreSQL on OSX Mavericks

2 thoughts on “How to install RPostgreSQL on OSX Mavericks

  1. it doesn’t work for me.
    “/RS-PostgreSQL.h:23:14: fatal error: ‘libpq-fe.h’ file not found

    include “libpq-fe.h””

Comments are closed.

Scroll to top