Xcode Command Line Tools Already Installed?
To develop software on a Mac, you'll need Xcode Command Line Tools. See the article About Xcode Command Line Tools.
To avoid complications, check if Xcode Command Line Tools are already installed. If already installed, check if you have the most recent version.
If you updated your machine from an earlier macOS version, you may have an outdated version of Xcode or the Command Line Tools in place. Read on to check if you have a troublesome out-of-date Command Line Tools.
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.
Is macOS up to date?
You should check your macOS version before you install Xcode Command Line Tools. Check macOS and update macOS if necessary.
Is Xcode already installed?
If you updated macOS from an earlier version with an "over the top" installation, your earlier development environment may remain intact. You will need to install the new version of Xcode Command Line Tools to avoid headaches. First, check what you have.
Check if you previously installed the full Xcode package:
$ xcode-select -p
You need to use the Terminal application to check from the command line, as shown above.
Scenario 1
If you see, xcode-select: error: unable to get active developer directory...
, the Xcode package is not installed.
Good! Jump to either section:
- Install Xcode Command Line Tools with Homebrew (recommended)
- Install Xcode Command Line Tools Directly (alternative).
The Xcode package is not installed
Scenario 2
If you see a file location that contains spaces in the path:
/Applications/Apple Dev Tools/Xcode.app/Contents/Developer
you will have problems installing Homebrew. You should delete Xcode before continuing.
Scenario 3
If you see:
/Applications/Xcode.app/Contents/Developer
The full Xcode package is already installed. Perhaps you installed it previously. If Xcode is installed, you will need to update Xcode to the newest version. Go to the App Store application and check "Updates." After updating Xcode, be sure to launch the Xcode application and accept the Apple license terms.
Scenario 4
If you see:
/Library/Developer/CommandLineTools
The Xcode Command Line Tools may be installed or an empty directory may be present.
Here's how to test:
$ ls /Library/Developer/CommandLineTools/usr/bin/git
You should see:
/Library/Developer/CommandLineTools/usr/bin/git
Remove an empty folder
If the Xcode Command Line Tools folder is empty, you should remove it.
Remove the empty folder:
$ sudo rm -rf /Library/Developer/CommandLineTools
Use sudo
for admin privileges. You must enter the password you use to log in to your computer (you will not see the password after entering it). After removing the folder, continue to the section, Install Xcode Command Line Tools with Homebrew.
Check the Xcode Command Line Tools version
As of September 2023, the Xcode latest version is 15.0.0. You can check the Wikipedia page for Xcode to find the version number of the latest Xcode release.
Check with Homebrew
If you've installed Xcode Command Line Tools with Homebrew, you can run brew config
to check. It will display 'CLT' and a version number.
Check with pkgutil
You can also check directly with pkgutil
. Check the version of Xcode Command Line Tools by running pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
in the Terminal application.
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.0.0.0.1.1694021235
You should see version 15 or newer.
Update if necessary
If the version is old, first Uninstall Xcode Command Line Tools and then Reinstall Xcode Command Line Tools.
What's next
If Xcode Command Line Tools are installed and up to date, you're done! You may want to Install Homebrew to continue setting up your development environment for programming.
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.