I tried to run gcc compiler in macOs monterey, but it shows invalid active developer path error. How can I resolve this ?

I have just updated my MacBook big Sur to Monterey. But after updating, whenever I tried to run GCC in the terminal it shows an invalid active developer path error. I am an absolute beginner, and can't resolve this error. Please help me to resolve this error.

Log:

gcc --version
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

macOS does not include GCC by default (although you can install it from the various Mac packaging sites). Rather, gcc is just an alias for clang:

% gcc -v      
…
Apple clang version 13.0.0 (clang-1300.0.29.3)
…

Are you trying to use GCC specifically? Or will the system’s default C compiler do?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I tried to run gcc compiler in macOs monterey, but it shows invalid active developer path error. How can I resolve this ?
 
 
Q