Originally published on my personal blog.
This is a small post about upgrading to gdal 2.x on a Mac using homebrew.
- You have homebrew installed and setup.
- You already have gdal 1.x installed via homebrew's default 'gdal' formula.
Unlink gdal 1.x using
brew unlink gdal
Tap into osgeo4mac
brew tap osgeo/osgeo4mac && brew tap --repair
brew install gdal2 --with-armadillo \ --with-complete --with-libkml --with-unsupported
brew link --force gdal2
$> gdal-config --version 2.1.1 $> gdal-config --libs -L/usr/local/Cellar/gdal2/2.1.1/lib -lgdal $> gdal-config --cflags -I/usr/local/Cellar/gdal2/2.1.1/include
If you are using R for geo-spatial stuff, be sure to reinstall the
rgdal library. Also you can now install sf in R using