I was able to install the pybind11 example here before I upgraded my MacOS. However, after I upgraded my MacOS to Mojave, when I compile the same example on that link, I see
I actually found the answer. I only needed to do
export MACOSX_DEPLOYMENT_TARGET=10.9
The installation went smoothly.