Installing PythonMagick on OS X
brew install boost- will take a lot of time and make your Mac hotbrew install --with-magick-plus-plus imagemagickcd <path_to_PythonMagick_source>./configure --with-boost=<path_to_boost_root>makemake installpython -c "import PythonMagick"
If PythonMagick build fails saying that it couldn't find -lboost_python navigate to <path_to_boost_root>/lib/, ln -s libboost_python-mt.dylib libboost_python.dylib and run make again.
Tested on 10.6.8 with Python 2.6.7 (custom build). Should work with Lion running stock 2.7.
NOTE: Looks like I was too quick to call it done. The module imports but raises exceptions when used. Bummer.
PythonMagick is working on MacOS Big Sur 11.2.3 with Homebrew and python 3.9
here are my installation steps. After having already installed homebrew;
Install dependencies, including the llvm clang compiler which is required to use OpenMP, since XCode's clang doesn't support it.
brew install python3 boost boost-python3 imagemagick llvmThis will take a while.
Get source
git clone https://github.com/ImageMagick/PythonMagickcd PythonMagickEdit
configureto correctly locate boost-python by replacing two instances ofax_python_lib=boost_pythonwithax_python_lib=boost_python39. My entries appear on lines 17992 and 18414. Your exact version of boost_python may vary in future, so checkls -l /usr/local/lib/libboost_python*first to see).Set BOOST_ROOT (your version may vary)
export BOOST_ROOT=/usr/local/Cellar/boost/1.75.0_2Run the configure script, telling it explicitly where to find the correct compilers (llvm clang) and which python version and boost libraries to use. Your versions for boost and python may vary.
./configure CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ PYTHON=python3.9 CPPFLAGS="-I/usr/local/Cellar/boost/1.75.0_2/include" LDFLAGS="-L/usr/local/lib"If the above works, then all that is required now is
make; make installIf the linking step fails during make with an error such as
ld: library not found for -l-L/usr/local/Cellar/imagemagick...then this indicates that libboost_python wasn't found by the configure script; the hanging-lis meant to point to-lboost-python39or similar.Similarly, if you get 'symbol not found' errors at runtime in python, this also indicates a failure to link to libboost-python. Make sure you've run
brew install boost-python3and usebrew doctorto check for any broken links. Also make sure you're not linking against any "legacy" libraries, especially if like me you upgraded to Big Sur over the top of Mojave or Catalina. You might want to wipe away libboost_python and completely reinstall it if this happens.python3 -c 'import PythonMagick'. If successful, there should be no output / errors.