Installing Xgboost on MacOS

I’ve tried many ways to pip install but kept running into the following error:

XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?

Eventually I gave up pip and this worked for me:

In terminal run:

$ git clone — recursive https://github.com/dmlc/xgboost.git

This should downloads a folder called “xgboost”.

Go to /xgboost/python-package

In terminal run:

$ python setup.py install

This should start installing xgboost.

If you run into the following error here again:

XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?

You need to download xgboost.dll file and put it into /xgboost/python-package/xgboost

Then run the following command again:

$ python setup.py install

This time it should work.