Can’t install Homebrew on macOS Mojave; installer doesn’t recognize Command Line Tools

homebrewinstallxcode

I'm trying to install Homebrew on macOS Mojave 10.14.6. To do this, I'm running the command line suggested at the Homebrew website:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Although my computer already has Xcode installed (updated to version 11 a few days ago, according to the version history), the Homebrew installer doesn't seem to be aware of this. Instead, it tries (and fails) to perform a fresh installation of the Command Line Tools.

Here's the output I get in the Terminal window:

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The Xcode Command Line Tools will be installed.

Press RETURN to continue or any other key to abort
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Password:
Timed out while loading data from the Apple Software Update server.
==> Installing the Command Line Tools (expect a GUI popup):
==> /usr/bin/sudo /usr/bin/xcode-select --install
Password:
xcode-select: note: install requested for command line developer tools
Press any key when the installation has completed.

At this point, the computer displays a dialog box asking me to either (a) install XCode or (b) visit the XCode page in the App Store. Neither of these options does anything useful. (I either get to see a progress bar doing nothing for 5 minutes, or the App Store opens and confirms that, yes, XCode has indeed been installed.)

Is this a temporary issue caused by the version 11 update of XCode? Can anyone suggest a solution or workaround?

Best Answer

Xcode command line tools is a separate package for Xcode

Download Command Line Tools for Xcode from developer.apple.com/download/more and install it again.

source: Installing Xcode Command Line Tools

Useful for troubleshooting

xcode-select -p