Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use xcodebuild on Mavericks with Command Line Tools installed

People also ask

Does Xcodebuild require Xcode?

The whole point is that 'xcodebuild' requires Xcode, i.e., a full install of Xcode, nor CommandLineTools.

How do I open Xcode command line tools on a Mac?

Start Xcode on the Mac. Choose Preferences from the Xcode menu. In the General window, click the Locations tab. On the Location window, check that the Command Line Tools option shows the Xcode version (with which the Command Line Tools were installed).

What is Xcodebuild command?

xcodebuild is a command-line tool that offers the ability to build and test your Xcode projects.


I know that this is a late answer, but in my case this command solved the issue:

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

It appears that OSX has changed xcodebuild to require XCode to be installed, where before it functioned properly with only the OSX Command Line Tools installed.

Old semi-related answer

Many people ran into this with Node. Node's build tool, gyp, uses xcodebuild to prepare for compiling node packages. Mavericks has changed the behavior of xcodebuild so that it no longer works properly with gyp. This is being fixed at the moment. See the node-gyp issue

Once the changes have been deployed to NPM, you will be able to install the new node-gyp package and compile properly. You will also need to update your NPM version once the changes are incorporated into NPM.


Please first go to finder, next select Applications from left panel, next look for Xcode, and check if its name is Xcode or Xcode-Beta

If name is Xcode-Beta then enter this command in Terminal:

sudo xcode-select -switch /Applications/Xcode-Beta.app/Contents/Developer

If name is Xcode then enter this command:

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

Hope this answer might help for users with Beta version of Xcode

Thanks


This issue was due to xcode-select developer directory pointing to /Library/Developer, which only contained the folder CommandLineTools. To this end, the error message is complaining about not the directory not being the same as Xcode.

Two tested solutions:

  1. (Re) Install Xcode.

  2. Point xcode-select to the Xcode Developer Directory using the following command:

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

References:

How to fix error like “xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory * BROKEN LINK *

xcode-select active developer directory error


I reinstalled Xcode from App Store which solved this issue. I guess my previous installation is not complete install


There's also a GUI to change the Command Line Tools path in Xcode > Preferences > Locations:

Xcode > Preferences > Locations

I just had this issue after upgrading to Xcode 10.3 while keeping an older copy of 10.2.1 in a sub-folder in Applications. When I opened this Locations panel the selection for Command Line Tools was blank, but I was able to choose between the two versions installed:

Command Line Tools selection dropdown

I tend to go with the GUI option if it's available instead of copying in sudo commands from SO.