Recently i tried to upgrade to new nokogiri version 1.10.5 and was not able to as the latest mac OS has moved some system folders around. For me the following steps worked. Assuming you already installed xcode
.
-
sudo xcodebuild -license accept
-
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer