xcrun: error: invalid active developer path

Just a quick post as I ran into an issue where GIT stopped working after I upgraded to macOS Monterey. When trying to run any Git command I would receive the following error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

The problem occurred because the xcode Command-line Tools needed to be updated after the macOS upgrade. To update the command-line tools, run the following command in a terminal session:

xcode-select --install

You should then see a window pop up asking if you want to download and install the command-line tools. This took around 10 minutes for me after confirming I wanted to proceed. (Note: You can manually download the install package here). Once the process completed, I restarted the terminal session and was once again able to use Git without any issues.

For more information on the xcode-select command, check out the inline help:

xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path 

Hopefully this may help should you experience the same issue!

Related posts

Docker Exec Command With Practical Examples

Debugging with Git Bisect

A Beginners Guide to Azure Repos

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More