Fix Xcode Command-Line Tools: xcrun, xcode-select and Developer Path Errors

Match the exact error to its cause: missing Command Line Tools, the wrong developer directory or a Terminal using a different Xcode. Each fix has a diagnostic command, real output and a check.

Fix Xcode Command-Line Tools: xcrun, xcode-select and Developer Path Errors

Most xcrun and xcode-select errors come down to one setting: the active developer directory. Print it with xcode-select -p. If it points to /Library/Developer/CommandLineTools, you have compilers and Git but not xcodebuild or simctl. If it points to a folder that no longer exists, reinstall the tools or select an installed Xcode. Change it for one command with DEVELOPER_DIR, or for the whole Mac with sudo xcode-select --switch.

Quick Take

Run xcode-select -p and match your error in the table below. Missing tools after a macOS update: xcode-select --install. Need xcodebuild or simctl: sudo xcode-select --switch /Applications/Xcode.app. Need a different Xcode for one build only: prefix the command with DEVELOPER_DIR=/Applications/Xcode-beta.app.

The output on this page was produced on macOS 26.7.2 with Xcode 27.2 and the Command Line Tools installed side by side. The one exception, the invalid active developer path message, is quoted as widely reported.

Find your error

Error starts withWhat it meansUsual fix
xcrun: error: invalid active developer pathThe selected developer folder is missing or incompletexcode-select --install, or switch to an installed Xcode
xcrun: error: missing DEVELOPER_DIR pathDEVELOPER_DIR names a folder that does not existFix or unset DEVELOPER_DIR
xcode-select: error: tool 'xcodebuild' requires XcodeThe Command Line Tools are selected, and they do not include xcodebuildsudo xcode-select --switch /Applications/Xcode.app
xcrun: error: unable to find utility "simctl"Same cause: simctl ships only with XcodeSelect Xcode, then run sudo xcodebuild -runFirstLaunch if needed
No error, but the wrong Xcode versionAnother Xcode is selected, or DEVELOPER_DIR is set in your shell or CI jobCheck xcodebuild -version, then switch or set DEVELOPER_DIR per command

Check which tools your Terminal is using

These commands only read settings. Run them before changing anything:

xcode-select -p
echo "${DEVELOPER_DIR:-DEVELOPER_DIR not set}"
xcrun --find clang
xcodebuild -version
mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"

Or run the tools doctor script below. It prints the selected folder, every installed Xcode, what xcodebuild, simctl, clang, swift, git and make resolve to, and whether Xcode's first-launch setup and license are done. It changes nothing. On a Mac with Xcode selected:

$ bash xcode-tools-doctor.sh

Active developer directory
  xcode-select -p        /Applications/Xcode.app/Contents/Developer
  DEVELOPER_DIR          not set
  kind                   Full Xcode: /Applications/Xcode.app

Installed tools
  Xcode 27.2 (27B52)     /Applications/Xcode.app  <- selected
  Command Line Tools     /Library/Developer/CommandLineTools (2.0G)

What each command resolves to
  xcodebuild             /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
  simctl                 /Applications/Xcode.app/Contents/Developer/usr/bin/simctl
  clang                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  swift                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
  git                    /Applications/Xcode.app/Contents/Developer/usr/bin/git
  make                   /Applications/Xcode.app/Contents/Developer/usr/bin/make
  SDK                    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
  xcodebuild -version    Xcode 27.2
  first launch           done
  license                accepted

Copy the script, type pbpaste > xcode-tools-doctor.sh in Terminal to save it, then run bash xcode-tools-doctor.sh:

#!/bin/bash
# xcode-tools-doctor.sh
# Diagnoses which Apple developer tools this shell is using and why a command
# such as xcrun, xcodebuild, simctl, clang or git might fail. Read-only: it
# reports and suggests fixes, but never changes your settings.
#
# Usage:  bash xcode-tools-doctor.sh
# Guide:  https://appscreens.com/blog/fix-xcode-command-line-tools-errors
# Tested: macOS 26.7, Xcode 27.2 and Command Line Tools (bash 3.2).
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 AppScreens. Free to use, copy and change; please keep
# this header, including the guide link.

set -u
CLT=/Library/Developer/CommandLineTools
say() { printf "  %-22s %s\n" "$1" "$2"; }
fix() { printf "  -> %s\n" "$1"; }

printf "\nActive developer directory\n"
sel=$(xcode-select -p 2>&1); rc=$?
say "xcode-select -p" "$sel"
say "DEVELOPER_DIR" "${DEVELOPER_DIR:-not set}"
if [ -n "${DEVELOPER_DIR:-}" ]; then
  fix "DEVELOPER_DIR overrides xcode-select in this shell. Unset it to use the machine default."
fi
if [ $rc -ne 0 ]; then
  fix "No developer directory is selected. Install the tools: xcode-select --install"
elif [ ! -d "$sel" ]; then
  fix "The selected folder no longer exists (common after a macOS update, or a"
  fix "renamed or deleted Xcode). Reinstall the tools with xcode-select --install,"
  fix "or select an Xcode: sudo xcode-select --switch /Applications/Xcode.app"
elif ! xcrun --find clang >/dev/null 2>&1; then
  fix "xcrun cannot find tools in the selected folder. Reinstall the Command Line"
  fix "Tools (xcode-select --install) or select an Xcode with xcode-select --switch."
fi
case "$sel" in
  "$CLT") say "kind" "Command Line Tools only (no xcodebuild, simctl or Simulator)" ;;
  */Contents/Developer) say "kind" "Full Xcode: ${sel%/Contents/Developer}" ;;
esac

printf "\nInstalled tools\n"
apps=$(mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null)
if [ -z "$apps" ]; then say "Xcode" "none found by Spotlight"; fi
echo "$apps" | while read -r app; do
  [ -n "$app" ] || continue
  v=$(defaults read "$app/Contents/Info" CFBundleShortVersionString 2>/dev/null)
  b=$(defaults read "$app/Contents/version" ProductBuildVersion 2>/dev/null)
  mark=""; [ "$app/Contents/Developer" = "$sel" ] && mark="  <- selected"
  say "Xcode $v ($b)" "$app$mark"
done
if [ -x "$CLT/usr/bin/clang" ]; then
  say "Command Line Tools" "$CLT ($(du -sh "$CLT" 2>/dev/null | cut -f1))"
else
  say "Command Line Tools" "not installed"
fi

printf "\nWhat each command resolves to\n"
for t in xcodebuild simctl clang swift git make; do
  p=$(xcrun --find "$t" 2>&1 | head -1)
  say "$t" "$p"
done
say "SDK" "$(xcrun --show-sdk-path 2>&1 | head -1)"
v=$(xcodebuild -version 2>&1 | head -1)
say "xcodebuild -version" "$v"
case "$v" in
  *"requires Xcode"*) fix "xcodebuild, simctl and Simulator need full Xcode. Select it with:"
                      fix "sudo xcode-select --switch /Applications/Xcode.app" ;;
esac
if [ -x "$sel/usr/bin/xcodebuild" ] && [ "$sel" != "$CLT" ]; then
  if xcodebuild -checkFirstLaunchStatus >/dev/null 2>&1; then
    say "first launch" "done"
  else
    say "first launch" "pending"
    fix "Install required components: sudo xcodebuild -runFirstLaunch"
  fi
  if xcodebuild -license check >/dev/null 2>&1; then
    say "license" "accepted"
  else
    say "license" "not accepted for this Xcode"
    fix "Review and accept it: sudo xcodebuild -license"
  fi
fi

printf "\nNothing was changed. Matching fixes for each error:\n"
printf "https://appscreens.com/blog/fix-xcode-command-line-tools-errors\n"

Command Line Tools or full Xcode?

The Command Line Tools are a separate package installed in /Library/Developer/CommandLineTools (2.0 GB on our test Mac). They include clang, Swift, Git, make and a macOS SDK, which is everything Homebrew, Python and R packages, Ruby gems and most embedded toolchains need to compile. Apple's installation guide notes that "commands such as xcodebuild and xctrace only ship with Xcode", and simctl does too.

Pointing one command at the Command Line Tools shows the split:

$ DEVELOPER_DIR=/Library/Developer/CommandLineTools bash xcode-tools-doctor.sh

Active developer directory
  xcode-select -p        /Library/Developer/CommandLineTools
  DEVELOPER_DIR          /Library/Developer/CommandLineTools
  -> DEVELOPER_DIR overrides xcode-select in this shell. Unset it to use the machine default.
  kind                   Command Line Tools only (no xcodebuild, simctl or Simulator)
...
What each command resolves to
  xcodebuild             xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH
  simctl                 xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
  clang                  /Library/Developer/CommandLineTools/usr/bin/clang
  swift                  /Library/Developer/CommandLineTools/usr/bin/swift
  git                    /Library/Developer/CommandLineTools/usr/bin/git
  make                   /Library/Developer/CommandLineTools/usr/bin/make
  SDK                    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  xcodebuild -version    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
  -> xcodebuild, simctl and Simulator need full Xcode. Select it with:
  -> sudo xcode-select --switch /Applications/Xcode.app

If you have Xcode, you do not need the separate package for Xcode itself, but keeping both is common and harmless. Whichever folder is selected decides which clang, git and SDK the /usr/bin shims run.

Change the developer directory for one command or for the whole Mac

Apple's command-line tools settings guide describes two mechanisms:

  • For one command: set DEVELOPER_DIR. No administrator password is needed and nothing else changes. It accepts either the app or its Contents/Developer folder.
  • For every user on the Mac: run sudo xcode-select --switch, or choose an Xcode in Xcode > Settings > Locations > Command Line Tools.

Run the one you need. Use a beta Xcode for one command:

DEVELOPER_DIR=/Applications/Xcode-beta.app xcodebuild -version

Select Xcode for the whole Mac:

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

Select the Command Line Tools for the whole Mac:

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

Return to the default search:

sudo xcode-select --reset

Both forms of the path work for DEVELOPER_DIR:

$ DEVELOPER_DIR=/Applications/Xcode.app xcodebuild -version
Xcode 27.2
Build version 27B52

$ DEVELOPER_DIR=/Library/Developer/CommandLineTools clang --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin25.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

While DEVELOPER_DIR is set, xcode-select -p prints its value instead of the machine default, so check it before trusting the output. sudo xcode-select --reset removes a custom selection so the default search applies again, which normally finds /Applications/Xcode.app if it exists and the Command Line Tools otherwise. In CI, set DEVELOPER_DIR in the job environment rather than switching the machine.

Fix each error

xcrun: error: invalid active developer path

The full message usually reads:

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

Cause: the selected folder is missing or incomplete. It typically appears after a major macOS update, after deleting the Command Line Tools, or after deleting or renaming the Xcode that was selected. Git, make and clang all fail with it, because /usr/bin/git is a shim that asks xcrun where the real tool is.

Diagnose:

xcode-select -p
ls "$(xcode-select -p)"

Fix: reinstall the Command Line Tools, or select an Xcode you already have:

Reinstall the Command Line Tools:

xcode-select --install

Or select an installed Xcode:

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

Apple documents the first command's response as "xcode-select: note: install requested for command line developer tools", followed by an installer dialog. If the installer says the tools are already installed but the error remains, check for /Library/Developer/CommandLineTools/usr/bin/clang. If it exists, the selection points somewhere else, so run sudo xcode-select --switch /Library/Developer/CommandLineTools. If it is missing, remove the folder with sudo rm -rf /Library/Developer/CommandLineTools (the uninstall command in Apple's guide) and install again.

Do not rely on pkgutil --pkg-info=com.apple.pkg.CLTools_Executables to tell you whether they are installed: on our test Mac it reported no receipt while /Library/Developer/CommandLineTools held 2.0 GB of working tools.

Verify:xcrun --find clang prints a path and git --version prints a version.

xcrun: error: missing DEVELOPER_DIR path

The same problem, caused by an environment variable instead of the machine setting. A shell profile, a CI job or a tool's wrapper script exported DEVELOPER_DIR for an Xcode that has since moved:

$ DEVELOPER_DIR=/private/tmp/no-such-developer-dir xcrun --find clang
xcrun: error: missing DEVELOPER_DIR path: /private/tmp/no-such-developer-dir

$ DEVELOPER_DIR=/private/tmp/no-such-developer-dir xcode-select -p
/private/tmp/no-such-developer-dir

Fix: run unset DEVELOPER_DIR for the current shell, then remove the export from ~/.zshrc, ~/.zprofile or your CI configuration. Verify:xcode-select -p shows the machine default again.

xcode-select: error: tool 'xcodebuild' requires Xcode

To see it without changing your setup, point one command at the Command Line Tools:

$ DEVELOPER_DIR=/Library/Developer/CommandLineTools xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Cause: the Command Line Tools are selected. This is common after installing Homebrew first and Xcode later: Xcode is on the disk, but the machine still points at the smaller package. React Native, Flutter and Fastlane builds call xcodebuild and stop here.

Fix: select Xcode and finish its first-launch setup:

sudo xcode-select --switch /Applications/Xcode.app
sudo xcodebuild -runFirstLaunch
sudo xcodebuild -license

Verify:xcodebuild -version prints the Xcode version. xcodebuild -checkFirstLaunchStatus and xcodebuild -license check both exit with status 0 once setup and the license are done. If Xcode lives somewhere else, such as Xcode-beta.app, use that path instead.

xcrun: error: unable to find utility "simctl"

$ DEVELOPER_DIR=/Library/Developer/CommandLineTools xcrun simctl list runtimes
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
$ echo $?
72

Cause: simctl, the Simulator command-line tool, is part of Xcode, so the Command Line Tools cannot provide it. Exit status 72 is what scripts see. Through xcrun, other Xcode-only tools fail the same way: xcrun --find xcodebuild printed this message for xcodebuild in our test, while running xcodebuild directly prints the "requires Xcode" error above.

Fix: select Xcode as above. If simctl is still missing on a new install, sudo xcodebuild -runFirstLaunch installs required components, which Apple's components guide says includes the simctl utility. Verify:xcrun --find simctl prints a path inside Xcode.

In Xcode 27 the Simulator app became Device Hub, so scripts that run open -a Simulator fail with "Unable to find application named 'Simulator'". simctl itself is unchanged; use open -a DeviceHub to show the window. The Simulator command recipes cover the rest.

Terminal uses a different Xcode from the one you expect

No error, but builds use the wrong SDK or a beta compiler. Compare what each source says:

xcodebuild -version
xcode-select -p
echo "${DEVELOPER_DIR:-DEVELOPER_DIR not set}"
grep -n DEVELOPER_DIR ~/.zshrc ~/.zprofile ~/.bash_profile 2>/dev/null

DEVELOPER_DIR wins over the machine setting, so a forgotten export in a profile, a CI step or an IDE's run configuration explains most surprises. Remove it, or switch the machine with sudo xcode-select --switch. Opening a different Xcode app does not change what Terminal uses.

After a macOS update: a five-step check

  1. Run xcode-select -p and check that the folder exists.
  2. Run xcrun --find clang. If it fails, run xcode-select --install.
  3. If you build Apple apps, run xcodebuild -version and select Xcode if it fails.
  4. Run xcodebuild -checkFirstLaunchStatus; if it exits non-zero, run sudo xcodebuild -runFirstLaunch.
  5. Install updates to the tools with Software Update in System Settings or the softwareupdate command.

Building an iOS app and short on space after the update? The Xcode cleanup reference covers what old simulators, runtimes and device support files you can remove.

FAQ

What does xcrun: error: invalid active developer path mean?

The developer folder selected with xcode-select is missing or incomplete, often after a macOS update or after deleting Xcode or the Command Line Tools. Run xcode-select --install, or select an installed Xcode with sudo xcode-select --switch /Applications/Xcode.app.

How do I fix tool xcodebuild requires Xcode?

The Command Line Tools are selected and do not include xcodebuild. Install Xcode, run sudo xcode-select --switch /Applications/Xcode.app, then sudo xcodebuild -runFirstLaunch. Check with xcodebuild -version.

Why does xcrun say unable to find utility simctl?

simctl ships only with Xcode. If the Command Line Tools are selected, or DEVELOPER_DIR points to them, xcrun cannot find it and exits with status 72. Select Xcode with xcode-select --switch and confirm with xcrun --find simctl.

Do I need the Command Line Tools if I have Xcode?

Not for Xcode itself. Xcode includes the compilers, Git and SDKs. Many people keep both, and Homebrew or other tools work with either. Whichever folder xcode-select points to decides which tools Terminal runs.

What is the difference between DEVELOPER_DIR and xcode-select --switch?

DEVELOPER_DIR applies to the command or shell where it is set and needs no administrator password. xcode-select --switch changes the default for every user on the Mac and needs sudo. When DEVELOPER_DIR is set, it overrides the xcode-select setting.

How do I use a beta Xcode for one build?

Prefix the command with DEVELOPER_DIR, for example DEVELOPER_DIR=/Applications/Xcode-beta.app xcodebuild -version. The app path and its Contents/Developer folder both work, and the machine default does not change.

Quote this guide

You can quote sections, tables, commands and charts from this guide in your own posts, documentation or answers, as long as you link to this page. Please do not republish the whole guide. The scripts are MIT licensed, so you can copy and change them freely.

AppScreens.com, "Fix Xcode Command-Line Tools: xcrun, xcode-select and Developer Path Errors", 13 October 2026. https://appscreens.com/blog/fix-xcode-command-line-tools-errors

Sources

Tested on macOS 26.7.2 with Xcode 27.2 (27B52) and the Command Line Tools.

Turn raw app screens into installs

Make your app value obvious with professional, localized, store-ready screenshots for every required app store size. Trusted by 200,000+ app professionals, with 13M+ screenshots exported. Start free.

Browse templates