macOS xcode-selectHigh

xcode-select Error in macOS: Causes and Fixes

The article explains what causes xcode-select errors and how to fix them. You will learn how to install developer tools and configure environment variables.

Updated at February 16, 2026
5-10 min
Medium
FixPedia Team
Применимо к:macOS 10.15+ (Catalina and newer)Xcode 12+

What the xcode-select Error Means

The xcode-select error occurs when the macOS system cannot find an active developer tools package (Xcode or Command Line Tools). The xcode-select utility manages the path to these tools. Typical error messages:

error: unable to get active developer directory
xcode-select: error: tool 'xcode-select' requires Xcode

These errors appear when attempting to use git, make, gcc, or other utilities from the terminal, as well as when working with Homebrew, CocoaPods, or building projects. The problem indicates that the system does not know where the developer tools are located.

Common Causes

  1. Command Line Tools are not installed — after a clean macOS installation or system update, the tools package may be missing.
  2. Xcode is installed, but the license agreement hasn't been accepted — without accepting the agreement, the tools are not activated.
  3. Incorrect path in xcode-select — the xcode-select command points to a non-existent or corrupted folder.
  4. DEVELOPER_DIR environment variable — if this variable is set and points to an incorrect path, the system ignores xcode-select settings.
  5. Corrupted installation — Command Line Tools or Xcode files may have been damaged during an update or software removal.

Solution 1: Install Command Line Tools

The most common scenario is missing Command Line Tools. Install them:

  1. Open Terminal (via Spotlight or /Applications/Utilities/Terminal.app).
  2. Run the command:
    xcode-select --install
    
  3. A dialog window will appear. Click Install and follow the instructions (administrator password required).
  4. After completion, restart the terminal.

💡 Tip: If the installation window doesn't appear, download the package manually from Apple's official website. Select Command Line Tools for Xcode for your macOS version.

Solution 2: Set the Path with xcode-select

If Command Line Tools or Xcode are already installed, but the path is not set:

  1. Check the current path:
    xcode-select -p
    

    If the output is xcode-select: error: unable to get active developer directory, the path is not set.
  2. Set the path depending on your installed software:
    • For Command Line Tools:
      sudo xcode-select -s /Library/Developer/CommandLineTools
      
    • For full Xcode (if the app is in /Applications):
      sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
      

    ⚠️ Important: Use sudo because changing the system path requires administrator privileges. Enter your password when prompted.

  3. Verify the path is set correctly:
    xcode-select -p
    

    It should output the selected path.

Solution 3: Accept the License Agreement

After installing Xcode or Command Line Tools, you may need to accept the license:

  1. In the terminal, run:
    sudo xcodebuild -license
    
  2. Scroll through the license text using the Spacebar.
  3. At the end, type agree and press Enter.

After this, the tools will become available. If the license was already accepted, the command will display a corresponding message.

Solution 4: Reinstall Command Line Tools

If the tools are corrupted, reinstall them:

  1. Remove the current version:
    sudo rm -rf /Library/Developer/CommandLineTools
    
  2. Reinstall as in Solution 1:
    xcode-select --install
    
  3. Set the path (if it wasn't set automatically):
    sudo xcode-select -s /Library/Developer/CommandLineTools
    

Solution 5: Check the DEVELOPER_DIR Variable

The DEVELOPER_DIR environment variable can override the path set via xcode-select:

  1. Check if the variable is set:
    echo $DEVELOPER_DIR
    

    If the output is not empty, this could be the cause of the error.
  2. Remove the variable for the current session:
    unset DEVELOPER_DIR
    

    Or edit the files ~/.bash_profile, ~/.zshrc, or ~/.profile, removing the line with DEVELOPER_DIR.
  3. Restart the terminal and check if the error is gone.

Prevention

  • After a macOS update, always reinstall Command Line Tools, even if they were present before the update.
  • Accept the Xcode license when first launching after installation.
  • Do not change the xcode-select path manually unless you are sure of the correct path.
  • Regularly update Command Line Tools via softwareupdate --install or the App Store.
  • Check environment variables in scripts to avoid accidentally overriding DEVELOPER_DIR.

F.A.Q.

What does the 'unable to get active developer directory' error mean?
How do I check the current path used by xcode-select?
Do I need to install full Xcode to fix the error?
How to prevent the xcode-select error from appearing after a macOS update?

Hints

Install Command Line Tools
Specify the path to developer tools
Accept the license agreement
Check the DEVELOPER_DIR environment variable
Restart the terminal
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community