xcode-select: Failed to locate 'clang'


When I try to run the clang command, I get the following error:

xcode-select: Failed to locate 'clang', requesting installation of command line developer tools.

And then I’m getting this error:

The "clang" command requires the command line developer tools. Would
you like to install the tools now?

If I click "Install", I continue getting the same error.

I have tried: xcode-select --install

But that gives the following error:

xcode-select: error: command line tools are already installed, use
"Software Update" to install updates

My computer is an Apple M1, Monterey 12.5.

How can I install clang?

>Solution :

Ensure Xcode packages are up-to-date. Try running xcodebuild -runFirstLaunch.

Also, you can try opening Xcode after the update and accepting the prompt to load essential development tools.

Leave a ReplyCancel reply