xcrun: error: Invalid active developer path
If you are on this page, it is likely that you recently updated your macOS to the most recent version (currently MacOS Ventura), and you are now seeing the following error while attempting to perform git commands:
“xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun”
If so, you are at the appropriate location. The major source of this problem will be briefly discussed in the parts that follow, and we’ll then offer a very straightforward yet efficient fix, allowing you to resume doing (git) business as normal.
What is the reason of xcrun?
The reason why you are seeing this error by the time you have made a major upgrade on your Mac is due to the fact that you have not yet agreed to the license agreement for Xcode Command Line Tools.
Now it’s important to mention that git itself does not specify whether the error is coming from your local machine or the remote host. There’s a chance that you may see this error when interacting with remote (e.g. on git pull) but not when interacting with your local (e.g. git status). Based on the above, you may need to run the suggested solution outlined in the next section either on your local or remote hosts (or even both).
Steps to fix xcrun: error: invalid active developer path
Now in order to get rid of the problem, all you need to do is install the Command Line Tools package using the following command:
Note: The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.
Note that there’s no need to install XCode since it’s gonna be a huge installation. All you need (at least to solve the problem in question) is just the Command Line Tools which are just a few hundreds of MBs.
Now if the above command doesn’t do the trick for you then there’s a chance that you will also need to run the following command:
Sudo xcode-select –reset
error: invalid active developer path is one of the most common errors that developers see once they upgrade their machines to the latest OSX/macOS, whilst trying to run git commands. Rest assured though that this is not your fault — you just need to run the Command Line Tool installation command as demonstrated in the previous section and you should then be good to go!
Q. What is Xcrun Macos?
xcrun is a tool that helps managing Xcode versions on your system. It allows you to write scripts that don’t need to know where your Xcode instance or developer tools are installed.
Q. What is command-line developer tools Mac?
They allow programmers to compile programs and debug them, convert files, and perform a number of tasks for handling the resources required for making applications and other tools.
Q. How do I install command-line tools on Mac?
- Start Xcode on the Mac.
- Choose Preferences from the Xcode menu
- In the General panel, click Downloads.
- On the Downloads window, choose the Components tab.
- Click the Install button next to Command Line Tools.
Q. How do I install a DMG file on Mac?
Double-click the DMG file to make its content available (the name will show up in the Finder sidebar), and a window generally opens also showing the content. Drag the application from the DMG window into the Applications directory to install (you may need an administrator password).