Skip to content

How to Fix macOS xcrun: error: invalid active developer path

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix macOS xcrun: error: invalid active developer path. We cover key concepts, practical examples, and best practices.

The Problem

You run a command like git, make, or xcrun and get:

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

Xcode Command Line Tools are missing, corrupted, or the path is misconfigured.

Quick Fix

Step 1: Reinstall Xcode Command Line Tools

xcode-select --install

A dialog appears asking you to install the tools. Click Install.

Step 2: If the dialog says "already installed," force a reinstall

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

Step 3: Reset the active developer directory

sudo xcode-select --reset

This resets the path to the default active developer directory.

Step 4: Point xcode-select to Xcode app (if installed)

If you have Xcode installed from the Mac App Store:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Step 5: Accept the Xcode license

sudo xcodebuild -license accept

If the license has not been accepted, many developer tools fail.

Step 6: Verify the installation

xcrun --show-sdk-path

Expected:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Or:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

Step 7: Install only the Command Line Tools (without full Xcode)

xcode-select --install

For macOS Ventura and later, the command line tools can be installed independently of Xcode.

Step 8: Check for macOS SDK compatibility

ls /Library/Developer/CommandLineTools/SDKs/

After a major macOS upgrade, the existing SDK may be incompatible. Reinstall the command line tools.

Prevention

  • Reinstall Xcode Command Line Tools after every major macOS upgrade.
  • Keep Xcode updated through the Mac App Store.
  • Run xcode-select --install proactively before using developer tools.

Common Mistakes with xcrun error

  1. Misunderstanding that String is [Char] with poor performance for large text operations
  2. Using foldl instead of foldl' causing stack overflow on large lists
  3. Forgetting deriving (Show, Eq) on custom data types needed for debugging

These mistakes appear frequently in real-world MACOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What does xcrun do?

xcrun locates and runs developer tools from the active Xcode or Command Line Tools directory. It acts as a proxy to find the correct SDK path.

Why does the error appear after a macOS update?

macOS updates can remove or invalidate the Command Line Tools. The updated system expects a newer SDK version.

Do I need the full Xcode app or just Command Line Tools?

Only the Command Line Tools are needed for git, make, gcc, xcrun, and similar tools. Full Xcode is needed for iOS/macOS app development.

DodaTech Tool Reference

Doda Browser's Developer Environment Checker validates the Xcode Command Line Tools installation and alerts when tools are missing or outdated.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro