Installing rgdal on Mac OS X

July 23, 2010

(This article was first published on Computational Mathematics » R, and kindly contributed to R-bloggers)

The rgdal package contains bindings from R to the GDAL (Geospatial Data Abstraction Library) as well as the PROJ library. It is a dependency for numerous spatial statistics packages. Note that the binaries on the rgdal homepage are outdated — the most up-to-date version of the rgdal package can be found on CRAN.

Unsurprisingly, rgdal requires both the GDAL and PROJ framework to run. Both frameworks for Mac OS X are kindly maintained by William Kyngesburye and can be found here:

Unix Compatibility Frameworks

I recommend installing GDAL Complete as it contains both required frameworks in a neat little package.
At the time of writing, there are two versions of GDAL Complete:

  • GDAL 1.7 Complete
  • GDAL 1.6 Complete

Both should work for rgdal but note that currently, the stable Mac OS X version of Quantum GIS (QGIS 1.4) only runs with GDAL 1.6, so if you need to use QGIS as well, I would recommend installing GDAL 1.6.  If you’ve installed GDAL 1.7, then you’ll have to use the developer’s release of QGIS.
(May 19, 2011 update: Install GDAL 1.8 Complete as it works for both standard and developer’s release of QGIS)

Next, assuming you installed GDAL above with the default paths, you’ll need to install the R package from source (get package source here) with modified arguments either with install.packages() or through the terminal:

R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.6-33.tar.gz

If you’re getting this error:

Error: package ‘rgdal’ is not installed for ‘arch=i386′

when trying to load the rgdal package, it is because your version of rgdal was not compiled for the 32-bit version of R. You’ll need to run the 64-bit version of R ( on Macs).

You may also need to update the base version of the sp package as well as any other dependencies.

To leave a comment for the author, please follow the link and comment on their blog: Computational Mathematics » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Recent popular posts


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Dommino data lab

Quantide: statistical consulting and training



CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)