Installing Xcode Command Line Tools

Solution 1:

Apparently, there is some distinction between the command line tools installed for use by Xcode and the tools installed for system-wide use:

  • https://github.com/Homebrew/brew/issues/5002#issuecomment-425707878

For my machine, running xcode-select --install and choosing to install the tools from the window that popped up helped fix the problem. I was able to confirm that it was fixed when running brew config and seeing a valid entry for CLT:

macOS: 10.14-x86_64
CLT: 10.0.0.0.1.1535735448
Xcode: 10.0

Solution 2:

I had the same problem after upgrading to Mojave. Running

xcode-select --install

Led to the error

Can't install the software because it is not currently available from the Software Update server

Downloading the command line tools from developer.apple.com finally resolved the problem.

Solution 3:

I ran into a similar issue trying to install some python packages (with jsonnet as dependency), and found a solution here. After running;

xcode-select --install

Apparently you still have to install the package, which you can do from terminal;

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Although Steven already answered your question, I hope this helps someone!

Solution 4:

# Install Command-line tools as dependency for Homebrew
xcode-select --install # Sets the development directory path to /Library/Developer/CommandLineTools

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Mas (command-line interface for Mac App Store)
brew install mas

# Search for Xcode showing only the first 5 results
mas search xcode | head -5
# Install Xcode using App ID
mas install 497799835 # The appid for Xcode shown when doing search

sudo xcode-select -r  # Reset the development directory path to put to Xcode /Applications/Xcode.app/Contents/Developer

#sudo xcodebuild -license

# Updaate all Apple software and auto agree to any licenses and restart if necessary
sudo softwareupdate --install --agree-to-license -aR