Install Xcode Command-Line Tools (macOS)

Many small macOS scripts and developer utilities rely on Apple’s Command-Line Tools for Xcode package. Among other things, it ships:

  • gitsvn, and other version-control binaries
  • clang & friends for compiling C/C++/Obj-C
  • makeldstriparnm, …
  • SetFilePlistBuddy, and dozens of helper tools used in shell scripts

If you ever tried to run git on a fresh Mac and saw a dialog asking to “Install Command Line Developer Tools”, this is what macOS was talking about. Below are three quick ways to get them.

Time required: ? 2 – 3 minutes on a fast connection (700 MB download). No Apple-ID sign-in needed unless you prefer the full Xcode route.


1. One-liner in Terminal (fastest)

  1. Open Terminal.app (? Space ? Terminal).
  2. Run:xcode-select --install
  3. A small dialog appears – click Install and accept the license.

That’s it. After the installer finishes you can verify with:

xcode-select -p   # ? /Library/Developer/CommandLineTools
clang --version    # should print Apple clang …

2. Via the full Xcode app (App Store)

Installing the full 20 GB Xcode bundle also drops the command-line tools on your system. Choose this path only if you plan to use the Xcode IDE.

  1. Open the App Store and search for Xcode.
  2. Click Get / Install (Apple-ID required).
  3. Once Xcode finishes downloading, open it once so it can install its components.
  4. Verify:xcode-select -p # ? /Applications/Xcode.app/Contents/Developer

3. Manual .pkg download (offline machines)

Apple hosts standalone installer packages on the Developer website:

  1. Sign in at https://developer.apple.com/download/all/?q=command line tools (free account).
  2. Download the DMG that matches your macOS version, e.g. Command Line Tools for Xcode 15.3.
  3. Mount the DMG and double-click the .pkg inside.

Accepting the license non-interactively

Scripting a fleet of Macs? After installation run:

sudo xcodebuild -license accept

This pre-accepts the license so build systems won’t hang waiting for T&C confirmation.


Uninstalling (rarely needed)

To remove the standalone tools:

sudo rm -rf /Library/Developer/CommandLineTools

Then reinstall with xcode-select --install whenever you need them again.

?? Do not delete if they live inside Xcode.app – use Launchpad or Finder->Applications to remove Xcode instead.


Troubleshooting

• “Command line tools are already installed, use Software Update to install updates.” – They’re present; run softwareupdate -l to check for newer versions.
• xcode-select: error: command line tools are already installed, use Software Update to install – same as above.
• git: command not found even after installing – Open a new Terminal window or run hash -r to refresh your shell’s path cache.


Wrap-up

You now have Apple’s developer toolkit on your Mac. Most of the scripts in this repo (including the Hide Logic Extension helper) will “just work” from here on.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.