Install gdal 2.1 on Mac OS X

GDAL is a great library of your need if you’re working with GEO data.

On Mac OS X, To install it, simply type:

1
brew install gdal

will install the 1.3 version for you, if you need to newest 2.1+ version, try the following:

1
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/master/Formula/gdal-20.rb

For more details or when it doesn’t work, have a look at their Github
Also if you need the python bindings afterward, try:

1
2
3
4
export PATH=$PATH:/usr/local/opt/gdal-20/bin
export LDFLAGS=-L/usr/local/opt/gdal-20/lib
export CPPFLAGS=-I/usr/local/opt/gdal-20/include
pip install gdal


2017-03-16 update

If you have GDAL 1.x installed, could try:

1
2
3
4
brew unlink gdal
brew tap osgeo/osgeo4mac && brew tap --repair
brew install gdal2 --with-armadillo --with-complete --with-libkml --with-unsupported
brew link --force gdal2

also if you encounter some file missing problem when using python GDAL binding, try installing a proper python binding version

1
pip install GDAL==$(gdal-config --version | awk -F'[.]' '{print $1"."$2}')

Zhanzhao Deo Liang wechat
欢迎关注我的个人订阅号: deoXdeo
今天的午餐全赖有你支持!