this did not work for me, because I came upon this thread after getting the error messages after running clang, and when I went to XCode -> preferences -> Locations, my "command line tools" item was already populated by Xcode 13.4.1 (13F100). I'm using latest monterey as of September 2022 on 14 inch M1 pro.