rgdal on Mac OS X

This was a bit of a headache to get right. Here’s what worked on OS X 10.6.7 (Snow Leopard, i386 architecture, R version 2.12.2):

1) Download the “GDAL Complete” framework from http://www.kyngchaos.com/software/frameworks and install.

2) Open R, and on the startup panel in preferences, make sure the “Add ~/Library/R…” is checked (enables user-level install).

3) Use the R package installer (in Packages & Data menu) to install the sp package. CRAN binaries can be used, but select “at user level” for install location.

4) Download the rgdal package source from CRAN to a local drive.

5) Open Terminal, cd to the directory containing the rgdal source *.tar.gz file (e.g. rgdal_0.6-33.tar.gz), and install with the following command: 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

One thing to note is that the R64.app must be used even on an i386 architecture.

UPDATE: SEE SUBSEQUENT POST ON INSTALLATION ON OLDER MACHINES; AND THE ISSUE OF WHICH APP TO USE.

And in R…

> require(rgdal)
Loading required package: rgdal
Loading required package: sp
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.8.0, released 2011/01/12
Path to GDAL shared files: /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009
Path to PROJ.4 shared files: (autodetected)
>

Advertisements
This entry was posted in os x, packages, R and tagged , , . Bookmark the permalink.