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

Fix xcodebuild error: active developer directory is CommandLineTools

This error pops up when you've only got Command Line Tools installed, but xcodebuild needs the full Xcode app. Point xcode-select to the right path.

Quick answer

Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer, then verify with xcodebuild -version. If Xcode isn't installed, install it from the App Store first.

Why this happens

I've seen this error more times than I can count—usually right after a fresh macOS setup or a system update. You're trying to build something, maybe with Flutter or a React Native project, and boom: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance. Frustrating, right? The core issue is that your system's default developer directory points to the Command Line Tools package, which gives you tools like clang and git, but not the full xcodebuild binary. That only ships with the complete Xcode app.

This often happens when you run xcode-select --install to get Command Line Tools, but you never installed Xcode itself. Or maybe you had Xcode and it got moved or renamed. Either way, the fix is straightforward—point xcode-select to the real Xcode.

Fix steps

  1. Check if Xcode is installed. Open Finder and look in /Applications for Xcode.app. If you don't see it, head to the Mac App Store and download it. It's a big download (several GB), so grab a coffee.
  2. Once Xcode is installed, open a terminal. You'll want to switch the active developer directory. Run:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Enter your password when prompted. This tells macOS to use the Xcode installation for developer tools.

  1. Verify the switch. Run xcode-select -p — you should see /Applications/Xcode.app/Contents/Developer. Then test with xcodebuild -version. You'll see something like Xcode 15.4 and a build number. If you get a version, you're good.

Alternative fixes if the main one fails

Sometimes the path is different—maybe you have Xcode in a custom location. Use xcode-select -switch with the full path to your Xcode's Developer folder. For example:

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

If you're seeing this error in a CI environment or a fresh machine, you might just need to install Command Line Tools instead, then use the clang tools. But if you specifically need xcodebuild, the full Xcode is required. No way around that.

Also, check if Xcode's license hasn't been accepted. Run sudo xcodebuild -license and type agree if it prompts. I've seen that cause weird build failures too.

Prevention tip

To avoid this headache in the future, after you install Xcode, immediately run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer. Make it part of your setup routine. I've also seen systems automatically reset the developer directory after a macOS update, so if the error reappears after an update, you know exactly what to check.

One more thing: if you're using Homebrew, sometimes it expects Command Line Tools. Don't stress—you can have both. Just point xcode-select to Xcode, and Homebrew will still work fine. I've been running this setup for years without issues.

Related Errors in Programming & Dev Tools
ModuleNotFoundError Fix Python ModuleNotFoundError: No module named X 0X0000022C Fix ERROR_UNEXPECTED_MM_CREATE_ERR 0X0000022C on Windows java.lang.OutOfMemoryError: Java heap space Fix Java OutOfMemoryError: Java heap space 0XC0000417 Fix STATUS_INVALID_CRUNTIME_PARAMETER (0xC0000417) Fast

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.