For anyone else looking for a solution for this:
I was seeing this error when running clang --version.
So I found the comment from this guys, which solves it (it is the second post from
excelsior_ink on the discussion):
It seems it was caused maybe due to uninstalling homebrew. I fixed it by:
sudo xcode-select -r
https://discussions.apple.com/thread/252824300?answerId=252824300021#252824300021