xcrun: invalid active developer path after a macOS update (missing xcrun)
Frank Zhang
- 4 minutes read - 1957 wordsTL;DR
The title sentence often shows up after a macOS upgrade. Read the active developer path first, then install or switch Command Line Tools or Xcode the official way. This page is general guidance, not a record of one session.
Match invalid active developer path and missing xcrun before you reinstall anything, switch paths, or delete /Library/Developer/CommandLineTools. This page is general guidance, not a record of one session. The commands were not re-run on a Mac for this page. No session on this site has this error on screen. The sources are Apple Developer pages read on 2026-11-26. If man, the wording in a system dialog, or the text on the machine in front of you disagrees, that copy wins.
After a macOS upgrade, people often paste the following English sentence from Terminal. It shows up frequently when running git, git clone, or xcrun itself; other developer commands can print the same line. Trust the command that is actually on your screen:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
The path in parentheses, and the path after missing xcrun at:, are whatever your screen shows. The same sentence can also point under /Applications/Xcode.app/Contents/Developer.
Installing the command-line tools, read on 2026-11-26, says Xcode comes bundled with clang, notarytool, xcodebuild, and xcrun, and that if you install Xcode you do not need to install the command-line tools separately. Apple also offers the Command Line Tools for Xcode package as an alternative to a full Xcode installation. The package is installed at /Library/Developer/CommandLineTools. The same page uses git as an example of a command in that package: on a fresh install of macOS, invoking any command in Xcode or the package (such as git) from the command line prompts you to download and install the package.
So the sentence is first about this: the active developer directory is not valid, and xcrun is missing from the location that directory leads to. It is not an SSH failure, and it is not a repository permission problem.
Which sentences this page covers
This page is for xcrun: error: invalid active developer path, especially when it continues with missing xcrun at:. On 2026-11-26, en-US Google autocomplete for this root included xcrun error invalid active developer path, git xcrun error invalid active developer path, git clone xcrun error invalid active developer path, and the longer form that names /Library/Developer/CommandLineTools. zh-CN Google suggested the same English error, including the full path and missing xcrun.
It is not for these:
Host key verification failedorREMOTE HOST IDENTIFICATION HAS CHANGEDfromgit clone,ssh, orscp. Those belong on the host key page.ssh: connect to host … port 22: Connection refused. That belongs on the connection refused page.Permission denied (publickey). That belongs on the publickey page.- Other
xcrun: error:sentences, such asunable to find utility xcodebuild,unable to find utility simctl, orSDK "iphoneos" cannot be located. Those variants showed up the same day under zh-CN autocomplete forxcrun error. They are not the “invalid active path, missing xcrun” branch. The official install page saysxcodebuildandxctraceship only with Xcode, not with the Command Line Tools package. Do not treat “install the package alone” as the fix for those sentences.
Configuring command-line tools settings, read the same day, also records a different sentence: if there is no active developer directory, xcode-select --print-path prints Unable to get active developer directory, and tells you to set one with sudo xcode-select --switch or to read man xcode-select. That is not the title sentence, but it is the same broader problem: there is not a usable developer directory yet. Read the path first, then decide whether to install or to switch.
Why this often appears after a macOS upgrade
In the section “Keep the Command Line Tools for Xcode package up to date,” the same install page says that after a macOS upgrade you should check for new releases of the package with Software Update in System Settings or with the softwareupdate command, and that the version of the installed package may be incompatible with the new macOS.
That is why the same git command can work one day and print invalid active developer path after an upgrade. It does not prove that a particular Mac hit an incompatibility. It does show that Apple wrote “check the package after an upgrade” as a required step. Do not start by deleting the directory.
Read-only: see which path is active
These commands only read. They do not change files, and they do not open the install dialog.
xcode-select --print-path
ls -ld "$(xcode-select --print-path)"
ls -l "$(xcode-select --print-path)/usr/bin/xcrun"
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
xcode-select --print-pathis the official way to print the active developer directory. The configuration page, read the same day, gives two usual results:/Applications/Xcode.app/Contents/Developerwhen a copy of Xcode is selected, and/Library/Developer/CommandLineToolswhen the Command Line Tools package is the active directory. The standard location of Xcode is/Applications/Xcode.app. If it is installed somewhere else, trust theprint-pathresult.ls -ldshows whether that path itself is still there. If the path is gone, or it exists butusr/bin/xcrunis not under it, that matchesmissing xcrun at:in the error. Do notrmanything at this step.pkgutil --pkg-info=com.apple.pkg.CLTools_Executablesis the official command for checking the installed Command Line Tools package version. Apple’s example printspackage-id,version,volume,location, andinstall-time. If the command says that receipt is missing, that only means the package record is not there. Do not read it as an instruction to delete the directory immediately.
If print-path prints Unable to get active developer directory, there is no active directory yet, rather than a path that is present but missing a file. The next step is still the official install, or a switch if Xcode or the package is already on disk.
You can also run which -a git xcrun xcode-select. Those lines are read-only too. The output varies by machine. This page did not re-run them; the screen in front of you wins.
Official install: xcode-select –install
If Command Line Tools are not installed, or you need a package that is compatible after an upgrade, start with the command-line install in Apple’s documentation. The install page uses this example:
xcode-select --install
The terminal note recorded in that page is:
xcode-select: note: install requested for command line developer tools
A system dialog then appears. The official English steps are: click Install, agree to the Command Line Tools License Agreement, and click Done when the installation finishes. If the dialog is localized, the labels on the buttons on your screen win.
This step downloads and installs software. It is not a read-only command. Before you confirm it, check that the dialog came from the system itself. Dismissing the dialog will not repair the current xcrun error.
The same page also says you can sign in with an Apple ID on the More Downloads page of the Apple Developer website, search for the Command Line Tools for Xcode package you want, then download and install it on that Mac. You can install only one version of the package at a time. Do not download a package of the same name from an unofficial site.
If a full copy of Xcode is already installed, the official install page says you do not need a separate command-line tools package. In that case, do not treat “run --install again” as the only path. Check the switch step below first.
When Xcode or the package is already there: switch the active directory
The official configuration page says that to use commands from the Command Line Tools package, you need to select the package after installing it. To change the active developer directory:
sudo xcode-select --switch <path>
<path> is the developer directory of the Xcode app you want, or the path of the Command Line Tools package. --switch requires superuser permissions. The system will prompt for an administrator password.
Apple’s examples include:
sudo xcode-select --switch /Applications/Xcode-beta.app
sudo xcode-select --switch /Library/Developer/CommandLineTools
If your Xcode is in the standard location, use /Applications/Xcode.app in place of the beta path in the first line. If print-path still points at an Xcode app that you moved or deleted, switch to a copy that is still on disk, or to Command Line Tools if that package is already installed.
You can also choose a version from the Command Line Tools pop-up menu in Xcode > Settings > Locations. The configuration page says that change applies to every user account on the Mac. To override the directory for the current shell session only, set the DEVELOPER_DIR environment variable; that does not require superuser permissions. Labels in a localized Xcode copy are whatever that copy shows. Apple’s example has this form:
env DEVELOPER_DIR="<path>" <command>
Replace <path> with a developer directory or .app path of the kind above, and <command> with the command you want to try, such as xcrun or git --version. This is a temporary override. It does not change the default. Use it to check whether a path works, then decide whether to --switch.
After a switch or an install, run the read-only xcode-select --print-path again, then the command that failed. If you installed the package, the official page also suggests checking the version with pkgutil --pkg-info=com.apple.pkg.CLTools_Executables, and notes that the tools themselves live under /Library/Developer/CommandLineTools/usr/bin.
After a macOS upgrade, even if --install reports that the tools are already present, follow the official advice and check Software Update in System Settings for a compatible release, or use the softwareupdate command named on that page. This page does not invent flags for that command. The man softwareupdate on the machine wins.
Do not start by deleting the directory
The official install page documents removal of the package as an uninstall step:
sudo rm -rf /Library/Developer/CommandLineTools
That requires administrator privileges. It deletes the whole package directory. The same page says that after you remove the package, Software Update may still offer new releases, and that opting out of those updates takes a further sudo pkgutil --forget com.apple.dt.commandlinetools.
This page does not treat deleting the directory as the first fix for the title sentence. Install, update, or switch first. Consider uninstall only if you intend to remove the package, or if the official install or update still leaves xcrun missing and you plan to remove it cleanly and reinstall the official way. Do not run --forget unless you really want to opt out of later updates. Do not download a replacement directory from an untrusted site and copy it into /Library/Developer/.
Where this page stops
- The commands were not re-run on a Mac for this page. There is no first-hand screenshot. The sources are the Apple Developer pages dated above.
- This page does not treat
sudo rm -rf /Library/Developer/CommandLineToolsas the default repair. Apple lists it as uninstall. - This page does not describe getting Command Line Tools from unofficial sources, and it does not treat
xcode-select --resetfrom older release notes as the first-line step in the current documentation. The current configuration page documents--print-pathand--switch. - This page does not diagnose other
xcrunerrors such asunable to find utility …or a missing iPhone SDK, and it does not covergit clonefailures that are really SSH or host-key problems. - Search volume. This page does not add an external measurement.
Other paths on the site start at Start Here. The Chinese writeup is xcrun: invalid active developer path:macOS 更新后先装 Command Line Tools.
If this post helps, you can sponsor the blog. This is voluntary personal support, not a charitable donation.