rgeos on Mac

I did not find installing rgeos on Mac the most straightforward thing. I thought I’d share here what worked for me.

Step 1: Install GDAL

Step 2: Download rgeos (do not decompress)

Step 3: Open terminal and run the following command

sudo R CMD INSTALL ~/Downloads/ rgeos_VERSION.tar.gz –configure-args=’–with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config’

replacing VERSION in rgeos_VERSION.tar.gz with the rgeos version you have just downloaded.

Step 4: Open R and require(rgeos) to see if everything ran smoothly.