One often suggested magic incantation that sometimes removes the curse is the
following:
A magic incantation that should remove the curse, often suggested by Homebrew
itself, is the following:
@code{.sh}
xcode-select --install # try with sudo maybe
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
@endcode
If that doesn't help, the next step is to prevent multiple SDKs getting mixed
together by removing all folders inside `/Library/Developer/CommandLineTools/SDKs`
except the latest one. Simply [deleting them is the designated way](https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_CAN_I_UNINSTALL_THE_COMMAND_LINE_TOOLS_)