Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

git, clang or xcrun stops working because the active developer folder is gone

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

Short answer

The folder that xcode-select points to no longer holds developer tools, so xcrun, git, clang and make cannot start. Print the selected path with xcode-select -p, then either install the command line tools with xcode-select --install or switch the path to a full Xcode with sudo xcode-select --switch.

  • Applies to macOS 26 on Apple silicon, Xcode 26, xcode-select 2416
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the folder the system is using and check whether it exists. The path in the error is the same one; what matters is which of the two cases you are in: a Command Line Tools folder that is empty or missing, or an Xcode.app path that no longer exists.

    xcode-select -p
    ls "$(xcode-select -p)/usr/bin" | head -5
  2. 2Match what you see, then jump to its fix

    1. 1xcode-select -p prints /Library/Developer/CommandLineTools and listing that folder fails or shows no usr/bin/xcrunThe Command Line Tools package is not installed any moreFix
    2. 2xcode-select -p prints a path ending in /Contents/Developer, such as /Applications/Xcode-beta.app/Contents/Developer, and that folder does not existThe selected path points to an Xcode.app that was moved, renamed or deletedFix
    3. 3xcode-select --install answers that command line tools are already installed, yet xcrun still reports a missing path or missing toolThe Command Line Tools folder exists but is broken, and the installer says they are already installedFix

What does the error look like?

  • xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  • xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
  • The same message printed when you run git, clang, make or swift from a terminal

Cause 1 of 3

The Command Line Tools package is not installed any more

1Check

Apple's technote lists /Library/Developer/CommandLineTools as the place the Command Line Tools package installs to. When the error names that folder, either the package was never installed on this macOS install or its contents were removed. Check that the folder holds the tools.

ls /Library/Developer/CommandLineTools/usr/bin | head -5
ls /Applications | grep -i xcode

2Fix

Start Apple's installer for the tools, accept the prompt and wait for it to finish. If you have a full Xcode in /Applications you do not need this package: switch to Xcode instead (next cause).

xcode-select --install

3Verify

xcrun can find a tool again and git prints its version.

xcrun --find git
git --version

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 3

The selected path points to an Xcode.app that was moved, renamed or deleted

1Check

xcode-select stores one developer directory for the whole Mac. If you removed the Xcode that was selected, or renamed it, the stored path keeps pointing at the old location. List the copies you really have and compare them with the printed path.

xcode-select -p
ls -d /Applications/Xcode*.app

2Fix

Switch to an Xcode that exists. The command needs administrator rights and affects every user on the Mac. For one shell session only, set DEVELOPER_DIR instead of switching.

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
# one terminal only, no sudo:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

3Verify

The printed path now exists and xcodebuild reports a version.

xcode-select -p
xcodebuild -version

Confirmed by docs.flutter.dev

Did this fix it?

Cause 3 of 3

The Command Line Tools folder exists but is broken, and the installer says they are already installed

1Check

The installer refuses to run when it sees the folder, even if the folder is damaged. Apple's technote says the tools are removed by deleting /Library/Developer/CommandLineTools, so a damaged copy can be removed and installed again. If Xcode is installed, Apple notes that it bundles the tools, so remove nothing and use the previous cause.

xcode-select --install
ls -la /Library/Developer/CommandLineTools

2Fix

Delete the damaged folder, then run the installer again and finish the prompt. This removes only the Command Line Tools package, not Xcode.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

3Verify

The folder is back with a usr/bin directory and the tools run.

ls /Library/Developer/CommandLineTools/usr/bin | head -5
xcrun --find clang

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Do not delete or rename the selected Xcode.app without switching xcode-select first.
  • After a major macOS update, run xcode-select -p once and open Xcode once so its first-launch setup finishes.
  • On CI, set DEVELOPER_DIR per job instead of relying on the machine-wide setting.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.