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: 
According to my own reproduction of this issue in brew 0.9 and OSX 10.6.8, the problem is `--with-thread-unsafe` isn't being honored by the current brew formula file. You can verify this by checking the formula with `brew edit boost` and seeing if the option appears within the contents of the formula.

Because of this, `libboost_python-mt.a` and `libboost_python-mt.dylib` are being built instead of `libboost_python.a` and `libboost_python.dylib`.

The easiest ways to fix this are to edit your pgmagick setup.py to replace `boost_lib="boost_python"` with `boost_lib="boost_python-mt"` (as pointed out [here](https://stackoverflow.com/a/9868631/517815)) or to follow [the instructions and patch here](https://github.com/mxcl/homebrew/pull/8928). It's otherwise a known issue.
Does setting `DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib` in the environment help before the build

e.g

```
$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib
$ hg clone https://bitbucket.org/hhatto/pgmagick/src
$ cd pgmagick
$ python setup.py build

```