13 July 2022 Leave a comment Development
This error is often shown when an active Xcode installation is needed, but xcode-select still points to the Command Line Tools directory.
Essentially Mac OS uses either XCode or the Command Line Tools to build software on installation. By default, Mac OS does not come with Xcode installed, so Xcode-select will point to the /Library/Developer/CommandLineTools
directory.
In some cases, those Command Line Tools might not be enough. That’s when the system is complaining with the “tool ‘xcodebuild’ requires Xcode” message.
How to solve the issue?
Solution
- Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don’t have it yet.
- Accept the Terms and Conditions.
- Ensure Xcode app is in the
/Applications
directory (NOT/Users/{user}/Applications
). - Tell mac os to use Xcode instead of Command Line Tools:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer - Note: Make sure your Xcode app path is correct:
Xcode needs to be installed in:/Applications/Xcode.app/Contents/Developer
If you installed Xcode-beta, it should be installed here:/Applications/Xcode-beta.app/Contents/Developer
What is xcode-select?
macOS comes bundled with xcode-select. It’s a command-line tool that is installed in /usr/bin. It allows you to manage the active developer directory for Xcode and other BSD development tools. It allows you to switch between the Xcode command line tools, and the full-fledged Xcode installation.
What are Xcode Command Line Tools?
A subset of the whole XCode installation. These are command-line (Terminal application) tools for software engineers.
A Mac does not come pre-installed with all of the applications and resources required for programming. Instead, Apple offers developers the full programming environment Xcode, which can be downloaded and installed separately. With support for all Apple operating systems, the whole Xcode program is enormous, taking up more than 40GB of storage space. Although many software developers use Macs, many don’t create software for Apple devices.
They still require the Xcode package’s installed Unix-like tools and utilities. Thankfully, Apple offers a different, far smaller download called the Xcode Command Line Tools that includes all of the essential tools for software development. This smaller package may be installed via the Terminal program or as part of installing Homebrew, the well-liked Mac package manager.
How can the Xcode Command Line Tools be installed?
The Command Line Tools package can be installed by running the xcode-select --install
command in the terminal.