How to fix: xcrun: error: invalid active developer path
Recently, when attempting to use a git commit
command in the Terminal app, I saw an error message saying xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
. In this article, you will learn how to fix the error that leads to this error message. Let’s begin.
What causes this error
In my case, the below error appeared when attempting to run the git commit
command in the Terminal app on my MacBook Pro with macOS Big Sur (Version 11.2).
$ git commit -m "New commit" xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
The error message above is self explanatory. It saying that the active developer path (/Library/Developer/CommandLineTools
) is invalid. Therefore, the error is not related to git
itself, but to the Command Line Tools.
I am sure that the Command Line Tools is installed on my Mac; I already used these tools, and before everything was fine. In my case, this error appeared after upgrading macOS to version 11.2 called “Big Sur”. Therefore I thought that maybe I just need to reinstall the “Command Line Tools” on my Mac to solve the problem with paths in my “Command Line Tools” installation.
Now we know what caused this error.
How to solve it
Once we know what is causing this error message to appear, we can use it to solve the problem. It is a really easy process. To solve this problem, we need to install (or reinstall if it already installed) the Command Line Tools. Now, step by step guide.
Launch your terminal app. As a terminal app, I use the Terminal, but you can use any other terminal app.
For macOS users: The Terminal app can be found in the Utilities folder of your Applications folder, or use Spotlight to find it.
In the terminal, type the following command and press the Enter
key to install the Command Line Tools.
xcode-select --install
You must receive the following output:
xcode-select: note: install requested for command line developer tools
Click on the Install
button.
Agree with the “License Agreement” by clicking the Agree
button.
Let the installation do its work and don’t interrupt it. This can take a while, so be patient. In my case it took a few minutes.
Now restart the terminal app. I didn’t need to restart the terminal. But I know that in some cases it does not work without restart.
Finally, you can retype the command you were using when you saw the error message to verify that it runs without errors. (in my case the command was git commit
)
git commit -m "New commit"
[master 1ddfda0] New commit Date: Sun Feb 14 22:00:27 2021 +0300 2 files changed, 8 insertions(+), 2 deletions(-)
No errors. It works!
Conclusion
That’s it, you’re done. Now the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error should be gone. So simple isn’t it?
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
I hope this article has helped you learn how to fix the xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error. If this article has helped you then please leave a comment
Thanks for reading!
Milena is a web designer and illustrator. She spends her time translating our articles and wrote her own articles. Her personal website can be found at milenakiseleva.com.