Just a quick heads up in case you run into this issue. I ran into this after upgrading to macOS Big Sur.
To fix it, run this in a terminal:
sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install
After that, you’ll be prompted to install the command line tools and that should be it.
If that doesn’t work, in this link are a few other options.