Failed to build libxml2

Make sure you have libxml2 installed by homebrew:

brew install libxml2

Then specify the libxml2 config, dir, and lib during the install:

gem install libxml-ruby -v '3.1.0' -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include