A few weeks ago I decided to give Homebrew as package manager a try and move some of my projects to Mac OS X as development platform. Until now I really liked the advantages of using Ubuntu as virtual machine, have development dependencies separated from my day-to-day system, safely try stuff out and be able to rollback to a snapshot if something goes terribly wrong. Sharing hardware resources is obviously the drawback of given setup, which basically made me think about alternatives.
Homebrew is great so far: very easy to setup, integrates well with Mac OS X, large repository and a great “Formula” system to add your own packages.
When it comes to GIS applications and libraries on Mac OS X, William Kyngesburye’s site is one of the best resources you’ll find out there. I used his’ downloads quite a bit. But with the move to Homebrew, I also had the intention to manage my GIS packages with it. Although Homebrew doesn’t provide user friendly double-click-to-install packages, like William does, its Terminal commands are simple enough:
$ brew install mypackage
Drawback of having Homebrew manage my GIS dependencies was, as I noticed immediately, that William’s Quantum GIS package didn’t work any longer. So I decided to build Quantum GIS on my own, from source, against dependencies managed by Homebrew. The entire build process is very well documented on QGIS’s wiki. Using Homebrew for getting all dependencies is as simple as:
$ brew install python --framework --universal $ brew install postgis qt gdal geos proj \ sqlite libspatialite libiconv gsl pyqt qwt cmake
I edited the existing SIP-Formula slightly (added a “–universal” option) to meet QGIS’ requirements on Mac OS X.
$ brew install sip --universal
Next step is to configure and make QGIS. Some paths and libs weren’t found automatically by cmake, so I had to specify them:
$ cmake -D CMAKE_INSTALL_PREFIX=~/Applications \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=MinSizeRel \ -D WITH_INTERNAL_SPATIALITE=TRUE \ -D QWT_LIBRARY=/usr/local/lib/libqwt.dylib \ -D QWT_INCLUDE_DIR=/usr/local/include \ -D GEOS_INCLUDE_DIR=/usr/local/include \ -D GEOS_LIBRARY=/usr/local/lib/libgeos_c.dylib \ -D GDAL_INCLUDE_DIR=/usr/local/include \ -D GDAL_LIBRARY=/usr/local/lib/libgdal.dylib \ -D GSL_INCLUDE_DIR=/usr/local/include \ -D GSL_LIBRARIES=/usr/local/lib/libgsl.dylib \ -D POSTGRES_INCLUDE_DIR=/usr/local/include \ -D POSTGRES_LIBRARY=/usr/local/lib/libpq.dylib \ -D PYTHON_EXECUTABLE=/usr/local/bin/python2.7 \ .. $ make $ make install
…produces the QGIS.app in your ~/Applications folder.
The Homebrew Formula for QGIS that I’ve started, doesn’t make a successful QGIS build yet. It fails somewhere at
Linking CXX shared library libqgis_analysis.dylib
[ 33%] Built target qgis_analysis
make: *** [all] Error 2
…although Homebrew is basically building against the same dependencies as my “manual” steps did – working on it.
So far so good. However, the bad news, maybe just in my case, is that QGIS seems to be linked to Mac OS 10.6 original Python version 2.6.1 and throws following error at startup:
Couldn’t load SIP module. (note: SIP is installed in /usr/local/bin)
Python support will be disabled.
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named sip
2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)]
Major downer here is the second line, “disabled Python”, which means most plugins won’t work. This is major since one of Quantum GIS’ strength is its plugin-architecture.
To be continued…