macOS runner: "xcrun: error: invalid active developer path" in CI
xcrun reads the active developer directory chosen by xcode-select. If that path does not exist, every tool launched through xcrun (clang, git, make) fails with "invalid active developer path".
What this error means
A build or even git fails with "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: ...", usually after an Xcode or CLT change.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrunCommon causes
xcode-select points at a removed directory
The active developer path was set to a CommandLineTools or Xcode location that no longer exists on the runner, so xcrun cannot resolve any tool.
Command Line Tools were not installed or were removed
After an OS or Xcode update the CLT bundle can be absent, leaving the path xcode-select references empty.
How to fix it
Point xcode-select at an installed toolchain
- List available toolchains and pick an installed Xcode or CLT path.
- Set the active developer directory with xcode-select.
- Re-run; xcrun now resolves tools from a valid path.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcrun --versionReset to the default Command Line Tools
When no full Xcode is needed, reset xcode-select to the default CLT location (or reinstall CLT) so xcrun works.
sudo xcode-select --reset
xcrun clang --versionHow to prevent it
- Set xcode-select explicitly to the Xcode version your build needs.
- Verify
xcrun --find clangearly to catch a bad path fast. - Avoid mutating the developer directory without resetting it after.