Install rgeos on OSX

A short description of the post.


Center for Environmental Studies


March 31, 2015

There seems to be some nefarious conspiracy against packaging spatial R packages on the mac platform. Don’t quite understand it but it sucks. Here is how to install the rgeos package.

If you try the normal way, you get the following error:

package ‘rgeos’ is available as a source package but not as a binary
Warning in install.packages : package ‘rgeos’ is not available (as a binary package for R version 3.1.3)

which is not very helpful. So here is a quick way to do that I use when I need to upgrade it or put it on a new machine.

  1. If you do not have the developers tools from Apple, download them and install through the normal AppStore mechanisms. You will need to compile stuff from raw code for this to work.
  2. Download and install the GDAL Complete package from KyngChaos. At the time of writing, it was version 1.11 (39.0 MB). If you are using Mavericks or later, you’ll have to probably change your security settings (System Preferences -> Security -> General) to “Allow apps downloaded from ‘anywhere’ to be installed. If everything works nicely (which I’ve never seen actually work), you should be able to do the following to install. Unfortunately, it always barfs on me.
    install.packages(“rgeos”, repos=“”, type=“source”) trying URL ‘’ Content type ‘application/x-gzip’ length 238246 bytes (232 KB) opened URL ================================================== downloaded 232 KB
The downloaded source packages are in ‘/private/var/folders/06/jmbn_ny94rs1nw19xclvdzqc0000gn/T/Rtmp9VCkBI/downloaded_packages’ Warning message: In install.packages(“rgeos”, repos = “”, : installation of package ‘rgeos’ had non-zero exit status
  1. This means that you need to actually compile the results. Download the latest sources from r-forge (use the *.tar.gz version). Open the terminal and:
    cd ~/Downloads
and you should see the following:

<pre class="lang:default decode:true ">R CMD INSTALL rgeos_0.3-9.tar.gz --configure-args="--with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config"