DEV Community

Cover image for GDAL 2 On Mac with Homebrew
Bhaskar Karambelkar
Bhaskar Karambelkar

Posted on

GDAL 2 On Mac with Homebrew

Originally published on my personal blog.

This is a small post about upgrading to gdal 2.x on a Mac using homebrew.

Assumptions

  • You have homebrew installed and setup.
  • You already have gdal 1.x installed via homebrew's default 'gdal' formula.

Install gdal 2.x

  • Unlink gdal 1.x using
    brew unlink gdal

  • Tap into osgeo4mac
    brew tap osgeo/osgeo4mac && brew tap --repair

  • Install gdal2.

brew install gdal2 --with-armadillo \
  --with-complete --with-libkml --with-unsupported
Enter fullscreen mode Exit fullscreen mode
  • Link gdal2
    brew link --force gdal2

  • Verify


$> 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
Enter fullscreen mode Exit fullscreen mode

Post Install

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 devtools::install_github('edzer/sfr').

Top comments (0)