I recently decided to get involved in Aaron Swartz’s latest project, watchdog.net. And since one of the most interesting jobs to me was investigating an alternative to Google Maps, I took the plunge and tried to look at Mapnik.
First challenge - just getting it to build on OSX. It seems like a trivial task, especially since people have already built it for OSX in general, but it unfortunately isn’t. There are a few pitfalls to avoid. The main Mapnik install documentation helps a lot, so I recommend reading that first. Especially the prerequisites part - you really need all the packages there. The port system helps a lot with this, but here are the issues I encountered:
- the build script requires libproj
- Before installing boost, you must install jam - there seems to be a dependency missing in the port file.
- When installing boost, make sure you install it with python support, specifically support for Python 2.5
Now that you’ve installed all the prerequisites, it’s time to fix up the buildscript
libtiff doesn’t live where it’s expected to live. Use the patch.
Or
and fix it by hand.
- Python site libraries on OSX are not installed in site-packages of the original python directory. They go to a completely separate path. Either figure it out yourself:
or use the patch.
There’s a syntax error in calling unicode functions - here’s the patch.
On machines that had a hand-install of python, mapnik will build but not run. To make sure that doesn’t hit you, make sure you never had a home-built version of python on your machine or remove its remnants. If there are python libraries in
/Library/Frameworks/Python.framework
, remove that folder.
Once all that is done, you just need to make & install: