1

Homebrew requires the XCode command-line tools to work. It never complains they are missing. But every time I do anything else that launches XCode, XCode itself asks me to install the command-line tools. I complained to Apple that once installed, they should be updated automatically when the rest of XCode is updated. Apple responded saying they do get included in the updates.

When I said, "Then why do I have to install them every time XCode launches?" there was no response.

The fact that homebrew builds and updates and installs always work suggests that they ARE installed. And this is confirmed by

WGroleau@MBP ~ % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

So why does XCode think they aren't, and how do I fix that?

Latest available non-beta versions of everything.  Issue has been present for many versions (two years or more).

There is a related question, but nothing there really helps.

3
  • What version of macOS and Xcode and command line tools?
    – mmmmmm
    Commented Jan 31, 2022 at 9:40
  • Which of the solutions in the linked question have you tried?
    – mmmmmm
    Commented Jan 31, 2022 at 18:33
  • At least two. But note that the command that is supposed to install the tools says it is already installed. Also, part of the reason it isn't helpful is that it is a different problem.
    – WGroleau
    Commented Jan 31, 2022 at 20:37

1 Answer 1

1

You haven't given enough information that we can give a definite fix, but I can help you along the way:

First, it is important to understand that there are multiple sets of "command-line tools" in play. The one installed globally to be used in the Terminal, for example HomeBrew is not the same as the one Xcode uses (by default).

As such, there's no contradiction in you being able to use command-line tools with HomeBrew to compile programs, while Xcode complains that its command line tools needs upgrading or are missing.

Also note that it is possible to have multiple versions of these command-line tools on your computer at the same time. Professional programmers often find themselves in situations where they need to have multiple versions of Xcode installed at the same time, and by extension of that, multiple versions of the associated command-line tools. This can be handled very easily using the Xcodes app (note the 's' at the end of the name).

I would advise opening Xcode up, open Preferences in the menu, navigate to the Locations tab and then under Command Line Tools make sure that you have selected the tools that are inside the Xcode app bundle.

7
  • To make things even more interesting, try a setup with a non-admin and an admin user. Everything works fine for the non-admin user but Homebrew (run by the admin user) may still complain about CLT because you also need to run xcode-select as admin now and then :-)
    – nohillside
    Commented Feb 1, 2022 at 13:25
  • Not pertinent to the question, but worth noting: home-brew must be run by the user that installed it. If another user tries, even with admin/sudo privileges, it gets seriously messed up!
    – WGroleau
    Commented Feb 1, 2022 at 17:42
  • The spot for CLT was blank. When clicked, the only item on the menu matched the installed version of XCode. Took another click to actually make it persist in the setting. If a launch of the XCode GUI requests installing, seems like a bug to leave that setting blank.
    – WGroleau
    Commented Feb 1, 2022 at 17:45
  • Sounds like xcode-select only affects the shell it is invoked in and not the XCode app. I only have one version installed and I only use it to tamper with binary plists. man xcode-select gives me the impression that using it should affect everyone/everything rather than affecting home-brew and not XCode.app. I'm going to take a risk with sudo xcode-select -r and see what the affects are.
    – WGroleau
    Commented Feb 1, 2022 at 17:50
  • @WGroleau Super - sounds like you got the problem fixed by the method I suggested here (changing the setting in Xcode). If that's correct, please mark the answer as accepted.
    – jksoegaard
    Commented Feb 1, 2022 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .