Install Command Line Tools Without Xcode
In this article
Yes, you can install the macOS command line developer tools without installing the full Xcode app. The Command Line Tools package includes compilers (like Clang and GCC), Git, Make, and other utilities needed for development. You only need a Mac running macOS and an internet connection. The simplest method is a single Terminal command that opens Apple's installer.
What You'll Need
- A Mac running macOS 10.9 or later (the command works on all recent versions).
- An internet connection to download the package from Apple.
- Administrator (admin) rights on the Mac, because the installer will prompt for your password.
Step-by-Step
- Open Terminal. You can find it in Applications > Utilities, or search for it with Spotlight (press Cmd+Space and type "Terminal").
- Run the install command. Type or paste exactly this and press Return:
xcode-select --install - Click "Install" in the pop-up window. A dialog will appear saying "The xcode-select command requires the command line developer tools. Would you like to install the tools now?" Click Install.
- Agree to the license. A software license agreement appears. Read it (or skim), then click Agree.
- Wait for the download. A progress bar shows the download and installation. It can take several minutes depending on your internet speed. Do not close the window or turn off your Mac.
- Verify the installation. When the installer finishes, the window disappears. In Terminal, run:
gcc --version
orgit --version
If you see version info, the tools are installed. If you get "command not found," see Troubleshooting below.
If the pop-up does not appear after running the command, or if you get an error, try the alternative method: download the package directly from Apple's developer site. Go to developer.apple.com/download/all/, sign in with your Apple ID (free), search for "Command Line Tools for Xcode," and download the version that matches your macOS. Then open the downloaded .dmg and run the installer inside.
Common Mistakes
- Typing the command wrong. The command is
xcode-select --install(two dashes before install). A single dash or a misspelling will fail. - Clicking "Get Xcode" instead of "Install". The pop-up has two buttons: "Get Xcode" (which opens the App Store) and "Install" (which installs only the command line tools). Choose Install.
- Assuming you need Xcode. You don't. The command line tools are a separate, smaller package.
- Forgetting to agree to the license. If you skip the agreement, the installation won't proceed.
Tips
- Check if tools are already installed. Before running the command, type
xcode-select -p. If it prints a path like/Library/Developer/CommandLineTools, they're already installed. - Use the same command to update. If you need to update the tools later, run
xcode-select --installagain; it will install the latest version. - Keep the tools after Xcode is installed. If you ever install Xcode, the command line tools will still work, but you can also choose to use Xcode's version by running
sudo xcode-select -s /Applications/Xcode.app. - Use Homebrew. Many developers install Homebrew (a package manager) after the command line tools. Homebrew actually requires these tools to work.
Troubleshooting
If the installation doesn't go as planned, try these in order:
- Run the command again. Sometimes the pop-up doesn't appear the first time. Wait a few seconds and try
xcode-select --installagain. - Check your internet connection. The download requires a stable connection. If it fails, retry after reconnecting.
- Restart your Mac. A simple restart can fix many installer issues. Then try the command again.
- Reset the xcode-select tool. In Terminal, run:
sudo xcode-select --reset
Enter your password, then try the install command again. - Download manually from Apple's website. If the command method fails, use the direct download link mentioned above. Make sure you pick the version that matches your macOS version (e.g., macOS Sonoma, Ventura, etc.).
- If you see "command not found" after install. The tools may not be in your PATH. Try logging out and back in, or restart your Mac. If that doesn't work, run
sudo xcode-select --switch /Library/Developer/CommandLineToolsto set the path manually.
Frequently Asked Questions
Do I need Xcode to install the command line tools?
No. The Command Line Tools package is separate from Xcode. It includes the essential compilers and utilities without the full IDE.
How long does the installation take?
It depends on your internet speed. The download is about 1-2 GB, so it can take anywhere from a few minutes to half an hour.
Will this give me the same tools as Xcode?
It gives you the core command line tools (Clang, Git, Make, etc.) but not Xcode's GUI, simulators, or additional SDKs. For most command line development, it's sufficient.
Can I install the tools on an older macOS?
Yes, as long as your Mac runs macOS 10.9 or later. For very old versions, you may need to find an older package on Apple's download page.
What if I get "Software is unavailable" error?
This usually means Apple's server can't find a matching version for your macOS. Try updating macOS to the latest version, or download the package manually from Apple's developer site.
Do I need to pay for an Apple Developer account?
No. A free Apple ID is enough to download the command line tools from Apple's website. The xcode-select command doesn't even require an Apple ID.