Using the latest GDAL with R packages on macOS - redux
As an update to an earlier post, here’s how to use the latest versions of GDAL/PROJ with R spatial packages.
Install GDAL
brew install pkg-config
brew install gdal
(Re)install R spatial packages
Next, we need to install a few packages from source in order to use the new GDAL libraries:
## (re)install spatial packages from source
install.packages(c("rgeos", "sf", "sp"), type = "source")
## rgdal requires some additional configuration to build correctly:
## based on http://stackoverflow.com/a/26836125/1380598
install.packages("rgdal", type = "source",
configure.args = c("--with-proj-include=/usr/local/include",
"--with-proj-lib=/usr/local/lib"))
library(rgdal) ## confirm the GDAL version being used

Dr. Chubaty is an ecologist, simulation modeller, and co-developer of the
open source SpaDES simulation platform. He completed his PhD at Simon
Fraser University modelling host selection in mountain pine beetle (MPB),
and postdoctoral research at Université Laval and Natural Resources Canada
developing forecasting models of MPB spread.
He currently operates FOR-CAST Research & Analytics in Calgary, Canada, which supports the development and integration of models simulating forest vegetation dynamics, wildfire, insect disturbance, and wildlife populations to inform decision making for land management and species at risk. He is an advocate for open source, open data, and reproducible workflows.