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. See About Xcode Command Line Tools.
I recommend using Homebrew, the popular macOS package manager, to install Xcode Command Line Tools:
If you prefer, you can install Xcode Command Line Tools without Homebrew. Here are instructions.
Before you get started
You'll need a terminal application to install Xcode Command Line Tools. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and worth a try.
Steps
Here are steps to install Xcode Command Line Tools directly.
- Check macOS and update macOS.
- Check if Xcode Command Line Tools was previously installed.
- Use
xcode-select –-install
to install Command Line Tools ("minus minus install with 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. 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 programgcc
- the GNU compilergit
- 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
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.