Xcode Command Line Tools Download and Installation FAQ

How to download, install, update, and uninstall Xcode command line tools on macOS

Xcode is a full-featured IDE from Apple for creating apps for iPhone, iPad, Mac, Apple Watch, and Apple TV.

You probably need some of its tools without installing the entire package. Maybe you want to write command-line software on macOS, or maybe you need to use the Homebrew package manager.

In that case, you only need a subset of it, which is the Xcode Command Line Tools.

Not in the mood for reading? Watch the video instead.

In this post, I’ve documented the four most frequently asked questions about the Xcode Command Line Tools: how to install, uninstall, update, or download Xcode Command Line Tools on Mac.

How to Install Xcode Command Line Tools

By default, you don’t really need to download the Xcode Command Line Tools from the Apple website (though I’ll show you how to do it later in another section).

Most modern Mac comes bundled with xcode-select command.

By using this command, you can download and install the latest Xcode Command Line Tools. All you need to do is enter the following command in Terminal:

xcode-select --install

Here is an example session when I install the Xcode Command Line Tools:

$ xcode-select --install
xcode-select: note: install requested for command line developer tools
Executing xcode-select –install from Terminal
Executing xcode-select –install from Terminal

After entering the command in Terminal, a pop-up window will appear for confirmation. Click Install to continue. If you change your mind, click Cancel.

Xcode command line tools install confirmation
Xcode command line tools install confirmation

A standard License Agreement will appear. If you want to, you can read it all. Click Agree to continue the installation process.

Xcode command line tools license agreement
Xcode command line tools license agreement

A pop-up window will then appear showing the download progress. At this point, you don’t need to do anything. Just wait until the download finishes. This can take a while, depending on your internet speed.

Downloading Xcode command line tools
Downloading Xcode command line tools

After a few minutes (or maybe longer), macOS will install the downloaded Xcode Command Line Tools.

Installing Xcode command line tools
Installing Xcode command line tools

Once the download and installation are complete, a final pop-up window will appear informing you that the Xcode Command Line Tools were successfully installed on your machine.

Xcode command line tools was installed successfully
Xcode command line tools was installed successfully

How to Uninstall Xcode Command Line Tools

If in the future you no longer need them and want to free up some space, you can uninstall them.

Unfortunately, there is no xcode-select --uninstall command. So you’ll have to remove them manually. Just type the following command in Terminal:

sudo rm -rf /Library/Developer/CommandLineTools

It will ask for your login password. Enter it and wait until the process finishes.

How to Update Xcode Command Line Tools from System Settings

Most of the time, when a new version of Xcode Command Line Tools is available, you’ll get an update notification from macOS System Settings. Usually, the update is released at the same time as the full Xcode app update.

You can update the Xcode Command Line Tools directly from System Settings. To perform the update, follow these steps:

Open System Settings, click General from the sidebar, then click Software Update.

Software Update from System Settings
Software Update from System Settings

If there is a new update available, you’ll see the version number and a button called Update Now. Just click it.

Xcode Command Line Tools update from System Settings
Xcode Command Line Tools update from System Settings

It will then ask you to read the license agreement. Just click Agree, I’m pretty sure nobody reads it anyway.

Xcode CLT license agreement
Xcode CLT license agreement

After that, macOS will download and install it in the background. No further action is needed.

Xcode CLT download and install from System Settings
Xcode CLT download and install from System Settings

Once the download and installation are complete, you can use it again from Terminal.

How to Update Xcode Command Line Tools from Terminal

As I mentioned earlier, you might be using the Xcode Command Line Tools mainly for Homebrew. That’s also the case on one of my machines.

One time, when I ran a check and update, I got the following message:

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.

My first instinct was to check for updates in System Settings.

But at that time, when I opened macOS Software Update, there were no updates available.

Then I tried reinstalling from the command line, but I got this error instead:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Unfortunately, there is also no xcode-select --update command.

That means we need to perform two manual steps to update the Xcode Command Line Tools: uninstall and reinstall.

Here’s the solution.

First, uninstall the current installation by removing its folder:

sudo rm -rf /Library/Developer/CommandLineTools

Then reinstall it from scratch:

xcode-select --install

Follow the installation prompts and wait until it finishes. Your Xcode Command Line Tools should now be updated to the latest version.

Download Command Line Tools for Xcode and Install It Manually

If none of the methods above work, you can download the installer manually from the Apple Developer website.

To install the Command Line Tools manually, follow these steps:

  1. Visit the Apple Developer download page.

  2. Log in with your Apple ID.

  3. Search for Command Line Tools for Xcode.

  4. Select the latest version you need.

    Xcode command line tools download page
    Xcode command line tools download page
  5. Download the Command Line Tools for Xcode*.dmg file.

  6. Mount the DMG and you’ll find a PKG installer inside.

  7. Double-click the installer and follow the installation instructions.

Video

Subscribe to Junian Dev YouTube channel

Final Thoughts

Alright, that’s all for today. Thanks for reading, and hopefully this short article helps you fix your problem.

As usual, if you have any questions, feel free to leave a comment below.

Cheers!

References