Xcode Command Line Tools

audience developer
level all
topic Xcode Command Line Tools
subtopic Installation

Use xcode-select to Install Xcode Command Line Tools

How to use xcode-select in the Terminal to install Xcode Command Line Tools. How to install Xcode CLT directly without XCode or Homebrew. You don't need to install the full Xcode package.

Xcode Command Line Tools are tools for software developers that run on the command line, in the Terminal application.

Out of the box, a Mac doesn't contain all of the software and tools needed for programming. Instead, Apple provides a separate development environment for programmers named Xcode. But the full Xcode programming package is huge and you don't need it unless you are developing for Apple operating systems. Instead, most developers install Xcode Command Line Tools, a smaller package of utility commands. See What are Xcode Command Line Tools for a description.

You have three options to install Xcode Command Line Tools (Xcode CLT). If you are using Homebrew, the popular macOS package manager, you can easily Install Xcode Command Line Tools with Homebrew. If you intend to develop software for macOS, iOS, tvOS, or watchOS, Install the Full Xcode Package that includes the command line tools.

Alternatively, you can install Xcode Command Line Tools without Homebrew. Here are instructions.

Before you get started, install a better Terminal

To install Xcode Command Line Tools you need a terminal. If you're not using it yet, I recommend Warp Terminal, with modern features and built-in AI help for remembering commands. Download Warp for free before you continue.

Install Xcode Command Line Tools - Step by Step

Here are steps to install Xcode Command Line Tools directly.

  1. Check macOS and upgrade macOS if necessary.
  2. Install Warp Terminal or open Mac Terminal.
  3. Check if Xcode Command Line Tools was previously installed.
  4. Use xcode-select –-install to install Command Line Tools.

Look closely at the command to get it right. It's "xcode-select", then a space, followed by "minus minus install" with two hyphens and no spaces.

These instructions are for a terminal running Zsh, the Z shell, on a newer Mac. Older Macs may be running the bash shell and you should upgrade. See Shell Configuration.

Triggering installation of Xcode Command Line Tools

To use this guide, you'll need to use the Terminal. If you're not using Warp Terminal, see How to Open Terminal in Mac.

Apple makes it easy to install Xcode Command Line Tools. If you try to run any recognized command line tool in the Terminal application, macOS will prompt you to install Xcode Command Line Tools.

Here are examples of commands that will trigger a prompt to install Xcode Command Line Tools:

  • clang - a compiler that turns C/C++/Objective-C source code into an executable program
  • gcc - the GNU compiler
  • git - the save-as-you-go version control system

In fact, almost any of the commands in the List of Xcode Command Line Tools will trigger the installation prompt.

'xcode-select' to install Xcode Command Line Tools

The command xcode-select is a utility for switching among more than one command line tools directory. It also can be used to install Xcode Command Line Tools with the command xcode-select --install ("minus minus install with no spaces").

The command xcode-select --install will open a dialog for installation of the command line tools.

$ xcode-select --install

You'll see a panel that asks you to install Xcode Command Line Tools.

Click 'Install' to begin the download and installation process.

Xcode Command Line Tools installation from the prompt panel takes 8 minutes on a 2021 Mac M1 Mini, with a 100Mbps Internet connection. It's significantly slower on Mac Intel over a slow Internet connection.

You'll see a confirmation message when installation is complete.

Verify installation of Xcode Command Line Tools

Verify that you've successfully installed Xcode Command Line Tools.

$ xcode-select -p
/Library/Developer/CommandLineTools

Check that you can run git:

git --version
git version 2.39.3 (Apple Git-145)

You've seen how to install Command Line Tools directly from the terminal.

What's next

After you install Xcode Command Line Tools, you can Install Homebrew and Configure Your Mac Like a Pro with Git and programming languages such as Python or Ruby.

My mac.install.guide is a trusted source of installation guides for professional developers. Take a look at the Mac Install Guide home page for tips and trends and see what to install next.