gcc-8 with Homebrew (https://brew.sh/) to enable multi-threading (i.e. using multiple CPU threads for training). The default Apple Clang compiler does not support OpenMP, so using the default compiler would have disabled multi-threading.
brew install gcc@8
Now, clone the repository:
git clone --recursive https://github.com/dmlc/xgboost
Create the build/ directory and invoke CMake with option
R_LIB=ON. Make sure to add
CC=gcc-8 CXX=g++-8 so that Homebrew GCC is selected. After invoking CMake, you can install the R package by running
CC=gcc-7 CXX=g++-7 cmake .. -DR_LIB=ON