Skip to content
ohsudo, Home
macOS

macOS "xcrun: error: invalid active developer path": fix it after a macOS update

Fix macOS "xcrun: error: invalid active developer path" when git, make or brew stop working: reinstall the Command Line Tools, or point xcode-select to Xcode.

Beginner2 min readApplies to macOS 13 and later · Command Line Tools for Xcode · Xcode · Homebrew

by OhSudo ·

Yesterday everything worked. Today, usually after a macOS update, git, make, gcc or brew stop with this:

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

On a Mac, git and the other developer commands in /usr/bin are small launchers. They ask xcrun where the real tools live. The message says the configured folder has no tools in it: the update removed or broke them, or you deleted Xcode. Your projects and your Git repositories are fine.

TL;DR

Terminal window
xcode-select -p # which folder is configured?
xcode-select --install # reinstall the Command Line Tools

A dialog opens; accept it and wait for the download. Then open a new terminal window and try git --version.

1. Reinstall the Command Line Tools

For most people this is all it takes:

Terminal window
xcode-select --install

Accept the dialog. It’s a download of a few hundred megabytes up to a few gigabytes, depending on the version.

2. “command line tools are already installed”

xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates

The folder exists but is broken, or the system thinks it’s fine. First try the update, which is the gentlest way:

Terminal window
softwareupdate --list
softwareupdate --install "Command Line Tools for Xcode-16.4" # use the exact label from the list

If there’s nothing to install, remove the folder and start again. It holds only these tools, none of your work:

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

Warning

Type that rm path exactly, and check it before you press Enter. /Library/Developer/CommandLineTools is safe to remove; a typo in a sudo rm -rf might not be.

3. You use the full Xcode

If xcode-select -p points to a Command Line Tools folder that’s gone, but Xcode is installed, or if it points to an Xcode that you moved or renamed, select the right one:

Terminal window
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept

Xcode’s first launch after an update may also need its extra components: xcodebuild -runFirstLaunch.

If you deleted Xcode and only need the command line, go back to the tools:

Terminal window
sudo xcode-select --switch /Library/Developer/CommandLineTools

Or reset to the default: sudo xcode-select --reset.

4. Check it worked

Terminal window
xcode-select -p
xcrun --version
git --version

Homebrew has its own check, and it’s worth running after a macOS update, since formulas may need rebuilding:

Terminal window
brew doctor
brew update && brew upgrade

5. In CI

On a macOS runner in GitHub Actions, this usually comes from a step selecting an Xcode version that isn’t installed on that image. List the installed ones with ls /Applications | grep Xcode, and select one of those.

Shell, we have a problem!

Similar, but different: xcrun: error: unable to find utility "simctl", not a developer tool or in PATH means the Command Line Tools are selected, but that tool comes only with the full Xcode. You have not agreed to the Xcode license agreements needs sudo xcodebuild -license accept. And xcrun: error: SDK "iphoneos" cannot be located also points to needing the full Xcode. For an app macOS won’t open, see is damaged and can’t be opened. npm modules that need the compiler fail with gyp ERR! until the tools are back.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Articles

Related articles