Installing Xcode command line tools provides essential utilities like gcc, make, git, and llvm for software development on macOS without requiring the full Xcode IDE. This is the fastest way to get a functional build environment for compiling code, running scripts, or using package managers like Homebrew.

What You'll Need

  • A Mac running macOS 10.15 Catalina or later
  • An administrator account with password
  • An active internet connection
  • Terminal app (found in Applications > Utilities)

Step-by-Step

  1. Open Terminal from Applications > Utilities or by using Spotlight (Cmd+Space, type "Terminal", press Enter)
  2. In the Terminal window, type the following command exactly and press Return: xcode-select --install
  3. A software update popup will appear titled "Install Command Line Developer Tools". Click the "Install" button to begin the download.
  4. Read and accept the license agreement when prompted by clicking "Agree".
  5. Wait for the installation to complete. This may take several minutes depending on your internet speed. Do not close the Terminal or put your Mac to sleep during this process.
  6. Once finished, verify the installation by typing: xcode-select -p and pressing Return. You should see a path like: /Library/Developer/CommandLineTools If you see this path, the tools are correctly installed.
  7. Optionally, confirm key tools are working by checking versions: gcc --version git --version make --version Each should return version information without error.

Common Mistakes

  • Running the install command with sudo: Using sudo xcode-select --install is unnecessary and can cause permission issues. The tool prompts for admin rights when needed.
  • Closing the Terminal or letting the Mac sleep during installation: This interrupts the download and may leave the tools in a broken state, requiring a retry.
  • Assuming the tools are installed after clicking "Install" in the popup: The popup only starts the download; you must wait for the process to finish and verify with xcode-select -p.
  • Trying to use the tools before accepting the license: The tools remain unusable until the license agreement is accepted via the popup.
  • Confusing the command line tools with the full Xcode app: The command line tools are a subset; they do not include the Xcode IDE, simulators, or graphical tools.

Tips

  • If you already have Xcode installed from the App Store, the command line tools are already included. You can still run xcode-select --install to ensure they are up to date or repair a missing installation.
  • After a major macOS update (e.g., from Ventura to Sonoma), the command line tools may need to be reinstalled. Running the install command again is safe and will update them.
  • Use softwareupdate --list in Terminal to see if updates for the command line tools are available separately from system updates.
  • If you prefer a silent install for scripting, you can use sudo xcode-select --install followed by waiting for the process, but note that the license agreement still requires manual acceptance via GUI — there is no fully headless method.
  • To reset the tools to factory state, run sudo xcode-select --reset before reinstalling.

Troubleshooting

If the installation fails or the tools do not work after following the steps:

  1. First, restart your Mac. This resolves transient issues with background processes.
  2. Check that you have sufficient disk space (at least 5-10 GB free). The tools require space to download and install.
  3. Verify your internet connection is working. Try loading a website in Safari to confirm.
  4. If the popup does not appear after running xcode-select --install, check for existing installations: run ls /Library/Developer/CommandLineTools. If the directory exists but tools fail, run sudo xcode-select --reset then try the install command again.
  5. If you see an error like "Can't install the software because it is not currently available from the Software Update server," wait a few hours and try again — Apple’s servers may be temporarily overloaded.
  6. As a last resort, download the command line tools manually from Apple’s Developer website (requires free Apple ID): go to https://developer.apple.com/download/all/, search for "Command Line Tools for Xcode", select the version matching your macOS, download the .dmg, and run the installer.
  7. After manual install, verify with xcode-select -p and tool version checks as in Step 6 above.

Frequently Asked Questions

Do I need the full Xcode IDE if I only want the command line tools?

No. The command line tools are a separate, much smaller package (~1-2 GB vs. Xcode’s 10+ GB) and are sufficient for compiling code, using git, or running build scripts.

Can I install these tools on an M1 or M2 Mac?

Yes. The command line tools are available for both Intel and Apple Silicon Macs. The installer automatically selects the correct architecture.

Will installing these tools affect my existing Xcode installation?

No. If you have Xcode installed, the command line tools are already part of it. Running the install command will not duplicate or conflict with the existing tools.

How do I update the command line tools?

Run xcode-select --install again. If an update is available, it will download and install it. You can also check via softwareupdate --list.

Is there a way to install these tools without using the GUI popup?

Not fully. While the download can be triggered via command line, accepting the license agreement requires manual interaction with the popup window. There is no fully automated, headless method supported by Apple.

What happens if I delete the CommandLineTools folder?

Deleting /Library/Developer/CommandLineTools will break the tools. You can restore them by running xcode-select --install again.