wiki:BuildingOnMac

Version 2 (modified by jorgearevalo, 12 years ago) ( diff )

Instructions updated with the solution to the problem caused by r23745

First of all, you can find a compiled version of GDAL in KyngChaos wiki (http://www.kyngchaos.com). Here, the links:

But if you're a GDAL developer, you probably want to compile GDAL by yourself. 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).

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.framewok/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"

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

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

with

LIBTOOL_LINK    =       $(LIBTOOL) --mode=link

Otherwise, you'll 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.

Note: See TracWiki for help on using the wiki.