Question: I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1. 

I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):

```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plus
$ brew install boost --with-thread-unsafe

```

then I'm cloning the repo at <https://bitbucket.org/hhatto/pgmagick>:

```
$ hg clone https://bitbucket.org/hhatto/pgmagick/src
$ cd pgmagick
$ python setup.py build

```

However I always receive the following error:

```
ld: library not found for -lboost_python
collect2: ld returned 1 exit status

```

Based on the output on stdout, setup *is* looking in the right place for the boost (`/usr/local/lib`).

I've also tried `easy_install` and `pip` but with no luck. I'm using Pythonbrew but have also disabled this and tried using the stock python install -- still no success.

Any suggestions on how I can fix the problem, or further diagnose the issue?

Answer: 
The boost\_python lib inside /usr/local/lib/ is named after libboost\_python-mt.a and libboost\_python-mt.dylib, since the default compiling is w/ multi-threads supporting enabled.

Grep boost\_lib="boost\_python" under ELSE condition in setup.py and replace it w/ boost\_lib="boost\_python-mt", will fix the "not found" issue.

Also it's OK to ln "-mt" version to libboost\_python.a: as described [here](https://stackoverflow.com/questions/2293962/boost-libraries-in-multithreading-aware-mode) for linux boost which no longer appends '-mt' suffix since 1.42. 

Ignore this line ~~or you could "with-boost-python=boost\_python-mt python setup.py install".
You could probably append '--with-boost-python=boost\_python-mt' to extra\_compile\_args inside setup.py, to achieve the same goal.~~

Furthermore, you could install pgmagick through pip in managed envs. Refs <http://rohanradio.com/blog/2011/12/02/installing-pgmagick-on-os-x/>
I've [submitted a pull request](https://github.com/mxcl/homebrew/pull/19722) to homebrew to build Boost with both mt and non mt (threaded and thread unsafe) binaries which are required to build pgmagick. 

Turns out this is a rather common problem, until the patch is accepted, you can check out or use my formula for Boost to build pgmagick.