I am running Monterey 12.5. My make command suddenly stopped working, prompting me to install Command Line Tools, but after installing from the pop-up I get the error
xcrun: error: invalid DEVELOPER_DIR path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
and indeed xcrun is missing in that directory. The issue is similar to this post but downloading the dmg and installing the tools manually does not fix my issue. I've tried all the fixes online like sudo xcode-select -r and sudo xcode-select -switch ... with restarts all over the place to no avail. Running xcode-select --install tells me
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
but of course there are no software updates for this.
I am able to run /Library/Developer/CommandLineTools/usr/bin/clang (which gets around tools like gcc which I believe just invoke xcrun to call clang) but nothing seems to be linked as I am met with
loop.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
If I run gcc from Homebrew, I can run gcc with no input files, but as soon as I run gcc -o loop loop.c I run into the same xcrun error.
In Xcode preferences, Locations/Command Line Tools says Xcode 13.4.1 (13F100) which matches the version of Xcode I have installed.
How can I fix the xcrun error?