macOS

Installing and Configuring Command Line Tools on macOS

In this guide, you'll learn how to install, update, and configure Xcode Command Line Tools on macOS for working with git, compilers, and other development utilities.

Updated at February 16, 2026
10-15 minutes
Easy
FixPedia Team
Применимо к:macOS Sonoma 14.xmacOS Sequoia 15.xXcode Command Line Tools 15.x+

Introduction / Why This Is Needed

Xcode Command Line Tools (CLT) is Apple's official suite of utilities required for software development on macOS without installing the full Xcode IDE. It includes compilers (Clang/LLVM), version control systems (Git, SVN), build utilities (Make), debuggers, and framework header files. Without CLT, many scripts, packages (e.g., via Homebrew), and development tools will not function. This guide will help you quickly install, verify, and configure this critically important component.

Requirements / Preparation

  • macOS 10.9 (Mavericks) or newer (relevant for Sonoma/Sequoia).
  • An administrator account (for installation).
  • A stable internet connection (download size ~1.5–2 GB).
  • Sufficient free space on the system disk (at least 5 GB recommended).
  • Terminal (Terminal.app) or any alternative shell (iTerm2, Hyper).

Step-by-Step Instructions

Step 1: Checking for Command Line Tools

First, determine if the tools are already installed. Open Terminal (Finder → Applications → Utilities → Terminal) and run:

xcode-select -p
  • If the tools are installed, the command will output a path: /Applications/Xcode.app/Contents/Developer (if Xcode is installed) or /Library/Developer/CommandLineTools.
  • If the tools are NOT installed, you will see an error: xcode-select: error: tool 'xcode-select' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance.

You can also check for specific utilities, such as Git:

git --version

If Git is not found, the system will usually prompt you to install CLT.

Step 2: Installation via System Dialog (Simplest Method)

The most common and convenient method is responding to a prompt when attempting to run a missing command.

  1. In Terminal, type any CLT command, for example:
    make --version
    
    or
    gcc --version
    
  2. A standard macOS dialog will appear with the prompt: "The command 'make' requires the command line developer tools. Would you like to install them now?"
  3. Click the Install button.
  4. Accept the license agreement (EULA).
  5. Wait for the download and installation to complete (can take 5 to 20 minutes depending on network speed).

⚠️ Important: Installation occurs under an administrator account. You may be prompted to enter the password for an admin user.

Step 3: Installation via Command Line (For Automation or Apple Silicon)

If the dialog does not appear (e.g., during an SSH session) or you want to automate the process, use the softwareupdate utility.

For Apple Silicon-based macOS (M1/M2/M3):

softwareupdate --install-rosetta --agree-to-license

This command will install Rosetta 2 (x86 emulator) and typically trigger CLT installation. For a direct CLT install:

sudo softwareupdate --install -a

This command will check and install all available system updates, including "Command Line Tools for Xcode".

For Intel-based Mac:

sudo softwareupdate --install -a

After running the command, enter the administrator password. The download and installation process may be lengthy.

Step 4: Verifying Successful Installation

After installation completes, restart Terminal (or open a new window) and check key components:

# Check Git (version control)
git --version
# Expected output: git version 2.xx.x

# Check Clang compiler
clang --version
# Expected output: Apple clang version 15.x.x (clang-1500.x.x)

# Check Make utility
make --version
# Expected output: GNU Make 3.x.x

# Check tools path
xcode-select -p
# Expected output: /Library/Developer/CommandLineTools

If all commands return version information and xcode-select -p shows the CommandLineTools path, the installation was successful.

Step 5: Configuring PATH and Selecting Active Version

Sometimes, especially when multiple tool versions exist (e.g., after installing full Xcode), the system might use the wrong ones.

  1. Explicit path selection: Prioritize Command Line Tools by running:
    sudo xcode-select --switch /Library/Developer/CommandLineTools
    

    This command tells the system to use the minimal CLT suite specifically, not the full Xcode (if present).
  2. Check PATH variable: Ensure the tools path is at the beginning of your PATH variable. Run:
    echo $PATH
    

    The output should include /Library/Developer/CommandLineTools/usr/bin (usually added automatically). If it's missing, add it to your shell's configuration file (~/.zshrc for Zsh, ~/.bash_profile for Bash):
    export PATH="/Library/Developer/CommandLineTools/usr/bin:$PATH"
    

    After adding, run source ~/.zshrc (or source ~/.bash_profile) to apply changes.

Verifying the Result

The primary indicator of success is the ability to run all basic utilities without errors. Perform a comprehensive check:

  1. Create a simple C file test.c:
    #include <stdio.h>
    int main() {
        printf("Hello from CLT!\n");
        return 0;
    }
    
  2. Compile it using clang:
    clang test.c -o test
    
  3. Run the compiled file:
    ./test
    
    Output: Hello from CLT!

If compilation and execution succeed, your development environment is ready.

Potential Issues

  • Error xcode-select: error: tool 'xcode-select' requires Xcode... after installation.
    • Cause: The path was not reset automatically.
    • Solution: Run sudo xcode-select --reset or explicitly select the path as in Step 5.
  • Permission denied error when running softwareupdate.
    • Cause: Insufficient superuser privileges.
    • Solution: Use the command with sudo and enter the administrator password.
  • Installation stalled or did not start via softwareupdate.
    • Cause: Conflict with an active proxy, Apple certificate issues, or update server unavailability.
    • Solution: Try installation via the dialog (Step 2). If that fails, check connectivity to developer.apple.com and temporarily disable any corporate proxy.
  • Commands work, but Homebrew complains about missing CLT.
    • Cause: Homebrew checks not only for binaries but also for header files (/Library/Developer/CommandLineTools/SDKs).
    • Solution: Ensure the full suite is installed. Reinstall CLT via the dialog. If the issue persists, check for the SDK: ls /Library/Developer/CommandLineTools/SDKs.
  • CLT stopped working after a macOS update.
    • Cause: OS updates often render older tools incompatible.
    • Solution: Remove the old tools: sudo rm -rf /Library/Developer/CommandLineTools and reinstall following Step 2 or 3.

F.A.Q.

Why do I need Command Line Tools if I have Homebrew?
Can I install Command Line Tools without Xcode?
Why does the git command still not work after installation?
Do I need to update Command Line Tools separately from macOS?

Hints

Check if Command Line Tools are installed
Install via system dialog
Install via command line (automated)
Verify successful installation
Configure PATH and select active version
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community