[GIS] Error Updating GDAL with Homebrew

gdalhomebrew

I recently updated my version of GDAL using the Homebrew package manager. However, now whenever I use GDAL from within my terminal shell, I get the following error:

dyld: Library not loaded: /usr/local/lib/libspatialite.2.dylib
  Referenced from: /usr/local/bin/gdaladdo
  Reason: image not found
Trace/BPT trap: 5

GDAL commands that are made from within QGIS, however, still work. (I'm assuming that a path needs to be updated, but have no idea how to proceed).

Best Answer

The GDAL version of QGIS:

  • If you use the QGIS version of KyngChaos (framework), it uses the version of GDAL which is in:

/Library/Frameworks/GDAL.framework/Versions/1.9 (or 1.8, 1.10)

and has nothing to do with Homebrew.

  • If you want to use the Kyngchaos version of GDAL in the shell:

enter image description here

  • or write in the .bash_profile file in your Home folder:

    export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH

  • If you want to upgrade the GDAL version used by QGIS, use the GDAL update of KyngChaos.
  • In addition, you can use in the shell any version of GDAL (1.8, 1.9,1.10) that are in the folder /Library/Frameworks/GDAL.framework/ simply adjusting the PATH.
  • All the Frameworks of Kyngchaos are compiled to to work together. The libspatialite.x.dylib are in /Library/Frameworks/SQLite3.framework/Versions/3/unix/lib and not in /usr/local/lib/ enter image description here

  • So in the same way, you can use spatialite in the shell

enter image description here

The GDAL version of Homebrew:

Your problem with Homebrew is that you must also install/upgrade the Spatialite Homebrew version. This is not done automatically as in the Frameworks of William Kyngesburye.

That's why I always use these frameworks (for not having n versions of GDAL and Spatialite).