As a developer, you depend heavily on git for managing your codebase and collaborating with your team. But you may face unexpected errors sometimes, which can impact your workflow negatively. And one of such error is the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
This error appears when you try to use git commands after upgrading or updating your macOS. And you’ll agree with me that it’s frustrating, especially when you’re trying to meet a tight deadline or you want to fix a critical issue.
The “invalid active developer path” error happens when git cannot find the active developer path, otherwise known as the directory where your project files are stored. This path is important for git to function accurately because it enables the version control system to track changes and manage your codebase.
So, when this path is invalid, it means git cannot perform its primary functions, which leads to errors and hindering you from working efficiently. But by the end of this guide, you’ll understand the causes of this issue and how to troubleshoot it.
Table of Contents
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
Most developer tools, including the git version control system, depend on Xcode Tools. Xcode Tools refer to a command line package that offers you a suite of software development tools made by Apple.
Therefore, without installing Xcode Tools, git cannot work. This Xcode Tools is basically used by developers, so it’s not built-in with a Mac. That’s another reason you’ll never see Xcode Tools on non-technical computers.
If you recently updated or upgraded your Mac computer, you’ll likely not have Xcode Tools in it. In that case, you’ll have to reinstall Xcode Tools to enable you use git. But if you’ve uninstalled Xcode Tools or reinstalled your system, then initiate a fresh install to solve this problem.
What Causes The “Invalid Active Developer Path”?
Before we discuss how to fix the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun in git, let’s talk about what causes this issue. Most times, you’ll see the xcrun: error: invalid active developer path in git after you upgrade or update your macOS and attempt to run the git command in the Terminal app.
This error message is very easy to understand. As it implies, it means that the active developer path at /Library/Developer/CommandLineTools, is invalid. Therefore, the xcrun: error: is not associated with git but rather the Xcode Command Line Tools.
However, this is not the only reason. Keep in mind that git doesn’t specifically tell you if the error is originating from your local machine or the remote host.
So, there’s every likelihood that you see this error when engaging with the remote host (like, on git pull), not when engaging with your local host (like, git status).
That being said, we suggest you run the solution we’ll provide on your remote or local hosts or both.
How To Fix “Invalid Active Developer Path” in Git
To fix the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun issue, you’ll need to install the Command Line Tools package with the command below:
xcode-select–install
The Command Line Tools package is downloaded separately from Xcode. So, both of them aren’t the same. The Command Line Tools package allows command line development in macOS. It also comes with the macOS SDK and Command Line Tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.
Since it’s a large installation, you don’t need to install Xcode. With just the Command Line Tools (about some hundreds of megabytes), you’re good to go!
But if this command doesn’t fix it for you, then you may need to as well run the command below:
sudo xcode-select–reset
As a developer, a common error you’ll encounter while attempting to run git commands after upgrading your system to the most recent OS X/macOS is the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
But don’t be agitated, the fault isn’t from you. Just run the Command Line Tools installation command, and it will be solved.
Check the Xcode.app location
If you’ve tried the above solution and you’re still getting the error message – xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun after updating or upgrading your macOS, there’s a chance that Xcode.app is in the Applications folder.
However, the system is searching elsewhere for it. So, check the location by following this command:
xcode-select -s /Applications/Xcode.app
Install CLT from the Apple Developer download page
Have you tried all the fixes above and they did not do the trick for you? Then, consider manually installing the Command Line Tools by directly downloading a DMG file from Apple.
To do this, visit developer.apple.com and download the updated version of Command Line Tools for Xcode. Afterward, install the file manually.
Bottom Line
Encountering the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error when using git can be very annoying. And it mostly occurs when you’re trying to run commands after performing an upgrade on your macOS.
Fortunately, this issue can be fixed. And we’ve discussed the possible troubleshooting steps in this guide. So, follow the solutions discussed in this guide to get your git workflow running again without any further challenges.