24

Does anybody know what's the easiest way to install GDAL 2.0 on a MacOSX?

The usual suspects kingchaos binary distribution and homebrew seem to be stuck on GDAL 1.11

I need support for TopoJSON feature properties that seem to have been included in 2.0

EDIT 2017/01/07: kingchaos binary distribution provides now the GDAL 2.1 distribution

5
  • The only solutions is to wait or to try to compile GDAL yourself.
    – gene
    Commented Jul 22, 2015 at 17:47
  • @gene thanks... I have no problem in building it from source... I'm wondering if there is any particular reason binaries are not available yet... Does GDAL 2.0 have any known issues? Can anybody shed some light? I'm surprised that 5 weeks have passed since 2.0 was released and there's no binary packaging yet...
    – tato
    Commented Jul 22, 2015 at 18:19
  • maybe holidays ?
    – gene
    Commented Jul 22, 2015 at 18:31
  • I've installed TopoJSON on OS X easily enough, and have converted JSON or SHP to TopoJSON. I don't see a need to have it part of GDAL.
    – Alex Leith
    Commented Sep 14, 2015 at 22:33
  • I need the reverse path: from TopoJSON to SHP, and keep the feature properties (this is what is missing in GDAL1.11)
    – tato
    Commented Oct 4, 2015 at 22:18

5 Answers 5

22

So far

brew install gdal --HEAD

resulted in

$ ogr2ogr --version
GDAL 2.1.0dev, released 2015/99/99
2
  • 1 error generated. error: command 'clang' failed with exit status 1
    – Andrii
    Commented Jul 25, 2016 at 11:41
  • @Sant Have more information about your error? Commented Oct 7, 2016 at 20:38
3

IMHO homebrew will be best/easiest, once their build issues are fixed. They are on the case, so if you have a GitHub account you may want to subscribe to notifications on the relevant issue - that way you'll know the moment it is available: https://github.com/Homebrew/homebrew/pull/42845

I just tried the Python easy_install route and it blew up my meagre 4GB RAM - so I'll be waiting for the brew formula..

Edit - August 2016

Homebrew now has a specific formula for GDAL 2+ gdal-20 which right now installs GDAL v2.1.0

3
  • The gdal-20 Formula is in an external branch. Install with brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/master/Formula/gdal-20.rb Commented Sep 2, 2016 at 13:56
  • That link is now broken. @Density21.5 Commented Jan 10, 2019 at 23:59
  • No working. Any update for GDAL 3+?
    – Dambo
    Commented Mar 24, 2020 at 13:26
3

As @Deo_Leung reported, the OSGeo Github is your friend. But it is even easier:

  brew tap osgeo/osgeo4mac
  #brew search gdal (if you want to see the various available versions)
  brew install gdal2

Start it and grab a coffee, as it is doing a real make behind the scene ;-)

Check as well the output to add the correct symlinks

4
  • can you add the commands to add the symlinks?
    – amc
    Commented Dec 9, 2016 at 16:40
  • This is subject to change depending on the version. Just read the output of brew install carefully, it is pretty straight forward :)
    – Rmatt
    Commented Dec 13, 2016 at 9:27
  • Except when it doesn't tell you what to run...
    – amc
    Commented Dec 13, 2016 at 13:17
  • 1
    I needed to do 'brew link --force gdal2'
    – amc
    Commented Dec 13, 2016 at 13:19
1

see OSGeo github for full detail

in short, as @Density commented(though his link has some wired characters): brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/master/Formula/gdal-20.rb

and probably you need to do the following for further usage 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

1
  • The link is now broken. Commented Jan 10, 2019 at 23:47
0

Solution found here: GDAL install on Mac: pip doesn't see gdal.h

Essentially, there is an error in the gdal-py2.7.pth file in the latest version of GDAL. The best way to correct it is to compile the GDAL bindings using the special commands provided in the thread.

To compile yourself the Python bindings, download the GDAL 2.1.0 python module and

python setup.py build_ext -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -L/Library/Frameworks/GDAL.framework/Versions/2.1/unix/lib -lgdal
python setup.py build
python setup.py install
2
  • 1
    Could you include the commands in your answer as links could become lost and render this answer useless Commented Jan 6, 2017 at 9:10
  • Sure thing, post now edited Commented Jan 6, 2017 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.