-
Notifications
You must be signed in to change notification settings - Fork 1
MacInstallation_Homebrew
First, make sure you have homebrew installed
Then make sure homebrew is updated:
brew updateNow you can either:
- Install Mapnik itself with homebrew (which will automatically install all dependencies at the same time)
- Install all Mapnik dependencies via homebrew and then Mapnik from source.
To see the options available for the build do:
brew info mapnikFor instance you should see --with-cairo, --with-gdal, and --with-postgis. Unless you supply --with-cairo Mapnik will not be built with Cairo rendering support. If you pass --with-gdal or --with-postgis then Homebrew will automatically install these dependencies before building Mapnik.
brew install mapnikIf you want both cairo rendering support and the ability to work with cairo objects (and pass them to mapnik) in python do:
brew install pycairo
brew install mapnik --with-cairobrew install cairo --without-x --without-glib
brew install icu4c
brew link icu4c
brew install boost
brew install proj
brew install jpeg
brew link jpeg
brew install libtiff
brew install gdal --with-libtiff=/usr/local/lib
brew link ossp-uuid
brew install postgis
brew install harfbuzz
git clone https://github.com/mapnik/mapnik.git
cd mapnik
./configure
make
make installNote that on Lion, you need may to be more explicit about SQLite. Change version as needed.
./configure CXX="clang++" JOBS=`sysctl -n hw.ncpu` SQLITE_LIBS=/usr/local/Cellar/sqlite/3.7.12/lib/ SQLITE_INCLUDES=/usr/local/Cellar/sqlite/3.7.12/include/
After you install mapnik, you may try to import it and get Fatal Python error: Interpreter not initialized (version mismatch?). If so, you likely have boost linked with the wrong version of python. To see what version of python boost is linked from, try:
otool -L `brew list boost | grep python-mt.dylib` | grep -i pythonIt's likely that your copy of boost was linked against the system python, but you're trying to use a homebrew python. To fix, uninstall boost, and reinstall with --build-from-source:
brew uninstall boost
brew install --build-from-source boostIf you need Cairo and its Python bindings, install and link these (cairo and py2cairo) with homebrew as normal. Then, to build Mapnik from source with Cairo:
./configure CXX="clang++" JOBS=`sysctl -n hw.ncpu` CAIRO=True PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig