For my MacBook Pro M1 Apple silicon for the case, I already tried all the previous answers and it was not solved.
I have solved it by the discussion in Unable to install Xcode command line developer tools.
There is have two options to solve, in my case...
- I have uninstalled Xcode, because I don't need it again
- install standalone mode, but it doesn’t work: "can't install the software"
- It was solved by trying to download it manually by command line tools. Check on the discussion thread for the link file (741.5 MB).