wiki:BuildingOnMac

If all you are looking for are pre-compiled binaries, you can find them in the KyngChaos? wiki:

Last version of GDAL: http://www.kyngchaos.com/software/frameworks#gdal_complete

But if you need to build GDAL, you have various options. Here are two:

The Homebrew way

1.- Follow the instructions to install Homebrew http://mxcl.github.com/homebrew/

2.- Compile and install the current release version of gdal

brew install gdal

This will bring any dependencies necessary (PROJ/GEOS/etc) with it, download them and install them.

If you want to compile the trunk version of GDAL instead, you can use the following command:

brew install gdal --HEAD

If you want to Compile and Debug using XCode, use brew to install gdal, then follow the instructions to setup XCode from here:

http://blog.burhum.com/post/35555678746/debugging-makefile-based-projects-using-xcode-gdal-as

The Framework way

It is possible to compile GDAL in Mac OS, following the instructions from http://www.kyngchaos.com/macosx/build/gdal, but some important things must be taken into account. These are the steps I've followed:

My machine: MacBook? with Mac OS X 10.6.8 (Snow Leopard). Update: Also working in Mac OS X 10.9 (Mavericks) and 10.10 (Yosemite)

1.- Install UNIX Tools for Mac, needed to compile. You can find them with XCode, as an option during installation

2.- Install GDAL pre-requisites. All of them can be found as dmg images in KyngChaos? wiki except one: Expat. You must compile it. So:

2.1 - Install dmg images (these are the versions for Snow Leopard, but use the ones you need from http://www.kyngchaos.com/software/frameworks):

2.2 - Compile Expat, following these instructions: http://www.kyngchaos.com/macosx/build/expat

3.- All the Frameworks are installed in /Library/Frameworks?. Now, you're ready to compile GDAL. The instructions are here: http://www.kyngchaos.com/macosx/build/gdal. BUT...

The paths shown in the instructions page may not work for you. If you followed the previous steps, the configure line you need to use is:

./configure --with-threads --disable-static --without-grass --with-jasper=/Library/Frameworks/UnixImageIO.framework/unix \
--with-libtiff=/Library/Frameworks/UnixImageIO.framework/unix --with-jpeg=/Library/Frameworks/UnixImageIO.framework/unix \
--with-gif=/Library/Frameworks/UnixImageIO.framework/unix --with-png=/Library/Frameworks/UnixImageIO.framework/unix \
--with-geotiff=/Library/Frameworks/UnixImageIO.framework/unix --with-sqlite3=/Library/Frameworks/SQLite3.framework/unix --with-odbc \
--with-pcraster=internal --with-geos=/Library/Frameworks/GEOS.framework/unix/bin/geos-config --with-static-proj4=/Library/Frameworks/PROJ.framework/unix\
 --with-expat=/usr/local --with-curl --with-python --with-macosx-framework --with-pg=/Library/PostgreSQL/9.1/bin/pg_config \
CFLAGS="-Os -arch i386 -arch x86_64" CXXFLAGS="-Os -arch i386 -arch x86_64" LDFLAGS="-arch i386 -arch x86_64"

Add --enable-debug, if you plan to debug GDAL.

WARNING: If you use a GDAL build newer than r23745, you may need to change GDALMake.opt.in. Specifically, replace this line

LIBTOOL_LINK    =       $(LIBTOOL) --mode=link    --tag=LD

with

LIBTOOL_LINK    =       $(LIBTOOL) --mode=link

Otherwise, you could get a linker error caused by libtool linking with gcc instead of g++. Related ticket #4557

4.- Execute make & sudo make install.

After that, your GDAL library should be correctly installed in /Library/Frameworks?/GDAL.framework. Now you can add /Library/Frameworks?/GDAL.framework/unix/bin to your PATH enviroment variable, in order to execute GDAL apps.

Last modified 8 weeks ago Last modified on Jan 25, 2017 7:31:47 AM