Executing developer commands such as git, brew, npm, or python3 in the macOS Terminal only to be stopped by the alert: xcode-select: error: active developer path (/Applications/Xcode.app/Contents/Developer) does not exist halts software development. This error occurs because macOS relies on the xcode-select utility to route developer tool calls to the active developer directory. When you upgrade macOS, remove a full installation of Xcode, or rely solely on standalone Command Line Tools, the system configuration pointer remains linked to a missing directory path.
Why Does xcode-select Fail to Find the Developer Directory?
The error arises when the global developer directory pointer points to an invalid filesystem path:
- Uninstalled Full Xcode Application: Deleting
/Applications/Xcode.appwhile keeping standalone Command Line Tools leaves the path pointing to the deleted bundle. - Major macOS Upgrades: Upgrades to macOS Sequoia or Sonoma routinely reset or invalidate existing developer shims inside
/Library/Developer/CommandLineTools. - Multiple Xcode Side-by-Side Installs: Renaming Xcode versions (e.g.
Xcode-beta.app) without updating the active pointer. - Corrupted Command Line Tools Receipt: Package receipts in the macOS Software Update catalog failing to reflect installed tool packages.
Step 1: Point xcode-select to Standalone Command Line Tools
If you only need Git, Homebrew, and command-line compilers without the full 15GB Xcode application, redirect the path to the native tools bundle.
- Open Terminal from Spotlight or Launchpad.
- Execute the following command to repoint the developer path:
sudo xcode-select --switch /Library/Developer/CommandLineTools - Enter your macOS administrator password when prompted and press Enter.
- Verify the updated active path:
xcode-select -p - Test that developer commands run without errors by checking your Git version:
git --version
Step 2: Install or Reinstall macOS Command Line Tools
If the /Library/Developer/CommandLineTools folder is empty or corrupted, reinstalling the packages restores the missing toolchain.
- Remove any damaged Command Line Tools residue by executing:
sudo rm -rf /Library/Developer/CommandLineTools - Trigger the official Apple software update dialog by running:
xcode-select --install - A graphical prompt will appear on your desktop asking: ‘The xcode-select command requires the command line developer tools. Would you like to install the tools now?’.
- Click Install and accept the Apple Software License Agreement.
- Allow macOS to download and unpack the packages. Once finished, run
xcode-select -pto confirm registration.
Step 3: Point to Full Xcode (If Installed)
If you intentionally installed Xcode from the Mac App Store, ensure the developer path matches the standard application bundle directory.
- Verify that
Xcode.appexists in your system Applications folder:ls -ld /Applications/Xcode.app - Point
xcode-selectto the embedded developer directory:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer - Accept the Xcode build licence agreement to unlock the toolchain:
sudo xcodebuild -license accept
Step 4: Reset the Active Developer Path Shim
If xcode-select continues referencing stale paths despite manual reassignment, reset the configuration to the operating system default.
- Execute the reset switch in Terminal:
sudo xcode-select --reset - Check the developer directory output:
xcode-select -p - Run
brew doctoror your preferred compiler to ensure your local development environment functions smoothly.