If you have a homebrew-installed library that you need to link against, use brew –prefix to set your LDFLAGS and CPPFLAGS:
brew install openssl
export LDFLAGS="$LDFLAGS -I$(brew --prefix openssl)/include -L$(brew --prefix openssl)/lib"
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include -L$(brew --prefix openssl)/lib"
I needed this to install the latest version of psycopg2. Before I set this, I was getting this error:
Library not loaded: libssl.dylib
I got part of the way there with this StackOverflow answer comment and the rest of the way with a StackOverflow answer that said to use LDFLAGS (setting DYDL_LIBRARY_PATH didn’t work for me) and the rest of the way from another StackOverflow answer that said to use LDFLAGS.