The Command Line Tools package is a small self-contained package available for download separately from Xcode that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, the Apple LLVM compiler, linker, and Make, which are installed in the /Library/Developer/CommandLineTools directory. If you use Xcode, these tools are also embedded within the Xcode IDE.
Follow the steps below to get started...
INSTALL XCODE COMMAND LINE TOOLS
Launch Terminal from your dock or from the Applications > Utilities folder.
Type the following command into the Terminal window and press Return.
A popup window will appear that reads:
The "Xcode-select" command requires the command line developer tools. Would you like to install the tools now? Choose Install to download and install the command line developer tools now.
Apple will then present a License Agreement for you to agree to.
macOS will now download and install the Xcode Command Line Tools.
Once the installation has completed. Apple will inform you that "The software was installed."
To verify a successful installation, simply try to use a command line tool or execute the following command:
This should display the path to Command Line Tools. It will look something like this:
If this is not the answer you received or if you received an error message, then try one of the alternative installation methods shared below.
ALTERNATIVE WAYS TO INSTALL XCODE COMMAND LINE TOOLS
Apple Developer Website
If you have an Apple Developer account, you can install Xcode Command Line Tools by downloading them from the dev center. This does not require you to have Xcode installed or even a download of the large Xcode package. Apple developers can navigate to https://developer.apple.com/download/all/ then search for "Command Line Tools for Xcode". Apple offers a DMG that can be downloaded for easy installation.
Mac users can also install Xcode tools using the Homebrew package manager. Xcode Command Line Tools are installed as part of the Homebrew installation. You can find instructions on how to install Homebrew here:
● How to Install Homebrew on Mac
UNINSTALL XCODE COMMAND LINE TOOLS
You can find instruction on how to uninstall Xcode command line tools here:
● How to Uninstall Xcode Command Line Tools [Video]