Install Xcode Command Line Tools with Homebrew
A bit about Homebrew
Homebrew is a popular package manager for macOS. It gives you an easy way to install Xcode Command Line Tools.
The updated homebrew installation gives you an option to install the Xcode Command Line Tools when you install homebrew on MacOS, which is a step forward in helping the developers setting up the right tools for development.
Homebrew gives you an option to install many many open source dev tools.
Steps to install Xcode Command Line Tools using Homebrew
Use this code to initiate homebrew installation
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
You’ll need to type your password after the code above starts executing. After the correct password, you’ll see a list of files and folders installing one by one.
Assuming that you don’t have XCode Command Line Tools installed on your machine, you’ll see this message.
“The XCode Command Line Tools will be installed.”
All you need to do is press the return key to keep the installation continue.
Verify the installation
brew doctor
If everything went well in the installation process, you’ll see this message:
Your system is ready to brew
Using this method, we can install both Xcode Command Line Tools and Homebrew.
Install Xcode Command Line Tools using the Command Line
Sounds weird, doesn’t it?
Start the installation using this command
xcode-select --install
A window prompt will be opened outside of the terminal. Click on Install and it’ll be downloaded and installed in a few minutes.
Verify the installation
xcode-select -p
You’ll see the directory where the Command Line Tools are installed.
/Library/Developer/CommandLineTools
command-line homebrew install Mac OS xcode