homebrew: Error: Xcode alone is not sufficient on..

Error occurs while:
> brew install XYZ


1
<span class="typ">Error</span><span class="pun">:</span> <span class="typ">Xcode</span><span class="pln"> alone </span><span class="kwd">is</span> <span class="kwd">not</span><span class="pln"> sufficient on......</span>

Force re-install CommandLineTools (deleting the previous version prior)


1
2
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

reference on StackOverflow