To install blpapi library for python on Mac OS, first download the C++ sdk from bloomberg.
Then unpack the tarball to a path you prefer. Take
/usr/local for example:
Next, try installing blpapi for python with pip, with env variable
BLPAPI_ROOT pointing to the C++ sdk's path.
BLPAPI_ROOT=/usr/local/blpapi pip install --index-url=https://bloomberg.bintray.com/pip/simple --upgrade blpapi
If you have the lastest xcode CLT installed, you might see a compiler error though:
blpapi/internals_wrap.c:20050:19: error: implicit declaration of function 'blpapi_ZfpUtil_getOptionsForLeasedLines' is invalid in C99
In this case, you have to fix the error first, goto bintray and download the python source tarball, then unpack it.
A quick search in the C++ sdk shows that the header file that defines the function in question is not included, just open
blpapi/internals_wrap.c in the python source directory and add a line to include the header file will fix the error.
Then proceed to install:
python setup.py install
That should be it! For much older versions I had to modify the generated _internal.so using
install_name_tool -change to help locate libblpapi3.so, which was not as pleasant an experience. Fortunately the newer versions have fixed the issue. It's worth mentioning that the installation on Linux is basically the same, with only one additional step to help locate libblpapi3.so, either by copying the file to
/lib/ or add the path of C++ sdk to ld.so.conf.
Hope this helps.