clang: error: : errorunsupported option '-fopenmp' on Mac OSX El Capitan building XGBoost

You installed gcc with Homebrew, yet the error is from clang. That should simply mean that your default compiler still points to clang instead of the newly installed gcc. If you read the comments in the Makefile, you'll see the following lines:

# choice of compiler, by default use system preference.
# export CC = gcc
# export CXX = g++
# export MPICXX = mpicxx

and in your case, you don't want the system one.
Note: gcc for the system points to clang:

$ which gcc
/usr/bin/gcc
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Instead, point those variables to something in /usr/local/bin, e.g.:

$ export CC=/usr/local/bin/gcc

and similar for the other two variables, CXX and MPICXX, e.g.:

$ export CC=/usr/local/bin/gcc;CXX=/usr/local/bin/g++;MPICXX=/usr/local/bin/mpicxx

Sir, perhaps you should use

cd xgboost; cp make/minimum.mk ./config.mk; make -j4

instead of

cd xgboost; cp make/config.mk ./config.mk; make -j4

as per the "Build On OSX" Section of build document


To solve this issue I did the following: I realized I had gcc 6 installed, so I ran:

export CC=gcc-6

But it didn't work by itself, so I had to also:

export CXX=g++-6

This solved it for me. I'm in a Macbook Pro running macOS Sierra. You can also make those changes directly on XGBoost's Makefile if you want. For more info about this: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_on_Mac_OSX?lang=en