DEV Community

loading...
Cover image for GDAL 2 On Mac with Homebrew

GDAL 2 On Mac with Homebrew

bhaskar_vk profile image Bhaskar Karambelkar ・1 min read

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').

Discussion (0)

pic
Editor guide