It seems mapnik is getting easier and easier to setup. I wanted to reinstall mapnik2 on a mac bloated with different versions of python, of macports… I just left my install of postgres/postgis/osm, and cleaned the system before installing mapnik.
You can still expect to run into a frew trouble and may have to update the formulas.
Macports (if installed)
Careful with the rm
…
Get rid of macports
%% sudo port -fp uninstall --follow-dependents installed
–edit– Check that you do not have software installed in /opt/local installed through non macport means:
%% sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \ /Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \ /Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports
Clean up the system (Python)
%% sudo rm -rf /System/Library/Frameworks/Python.framework \
/usr/bin/python* \
/Library/Frameworks/Python.framework \
%% sudo rm -rf /usr/local/lib/python \
/usr/bin/easy_install* \
/usr/bin/pydoc*
Clean previous installation of GEOS/Mapnik/etc
%% sudo rm -rf /Library/Frameworks/GDAL.framework \
/Library/Frameworks/FreeType.framework \
/Library/Frameworks/GEOS.framework \
/Library/Frameworks/Mapnik.framework \
/Library/Frameworks/PROJ.framework \
/Library/Frameworks/UnixImageIO.framework
Install Homebrew
Run
%% brew doctor
%% brew update
And fix the issues if any, like adding /usr/local/sbin
and /usr/local/bin
to your PATH.
Install Formula
%% brew install python
Modify your PATH (.bash_profile
) to add /usr/local/share/python
Install GDAL
%% easy_install numpy
%% brew install gdal
You may have to fix some things. I had to install GEOS with
%% brew install --use-gcc geos
Install icu4c
%% brew install icu4c
Install boost
%% brew install -v boost
(It’s ok if boost is compiled without ICU support)
Install Mapnik: (You might have to update your formula with this - brew edit mapnik
)
%% brew install -v mapnik
-v
gives you more information about the install. If for instance pg_config
is not found, add it to PATH.
To test your installation of mapnik, you can run the mapnik/demo/python/run_demo.py
script (from the mapnik-2.x.x.tar.gz
install file, which is by default in ~/Library/Caches/Homebrew/
)