0

OBSERVATIONS

I was not expecting the command to return an error:

/usr/bin/xcodebuild -version (Reference) returns an error:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

ls -l /usr/bin/xcodebuild returns:

-rwxr-xr-x 1 root wheel 31488 May 27 19:37 /usr/bin/xcodebuild

xcodebuild -version returns:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

gcc --version returns:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

QUESTIONS

Why is the an error returned in the first observation and what remedies are available?

How can I test (without installing anything to determine if I have the problem described here?

I am concerned that changing the active directory

sudo xcode-select -switch /Library/Developer/CommandLineTools

will cause problems with brew or other installed apps. Though it would seem that my active directory and the suggested change is the same.

UPDATES

$ ls -l /Applications/
total 0
drwxr-xr-x  4 user  admin  128 Jul 26 00:06 Polyspace
drwxr-xr-x@ 3 root  wheel   96 Apr 23 00:52 Safari.app
drwxr-xr-x@ 3 user  staff   96 Sep 30  2019 Sublime Text.app
drwxr-xr-x@ 3 user  staff   96 May 15 20:06 Transmission.app
drwxr-xr-x  4 root  wheel  128 May 27 19:31 Utilities
$ ls /usr/bin | grep -I Xcode
xcode-select
xcodebuild
  • What is the purpose of the updates you've made to the question? Also it seems that oyu already found the answer in stackoverflow.com/questions/17980759/…, why are you concerned about following the advice given there? – nohillside Jul 29 at 14:10
  • Thanks for the response: I think Xcode was installed when I installed brew. Based on the updates I think that Xcode.app (superset of Xcode?) is not installed. My concern is that I do not want 'break' whatever has been done with brew. Hopefully, my concerns are not warranted. – gatorback Jul 29 at 14:24
  • 1
    Xcode.app is Xcode, the same as Safari.app is Safari. – nohillside Jul 29 at 14:37
  • I installed Xcode from the App Store and executed the prescribed xcode-selectcommand. Xcode version is now returned – gatorback Jul 29 at 18:32
2

Why is the an error returned in the first observation

Because xcodebuild executable in /usr/bin is not useful without Xcode app.

I am concerned that changing the active directory... will cause problems with brew or other installed apps.

No it does not. When Xcode is installed, setting the xcode-select path to Xcode app gives you more features: in particular xcodebuild which is required for making Xcode projects from cmake etc.

The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

or the Command Line Tools at:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

depending on which is selected using xcode-select. The command line tools will search the SDK for system headers by default.

Source: https://developer.apple.com/documentation/xcode-release-notes/xcode-10-release-notes

So there will not be any problem as long as the tool you're concerned about works with SDK, and is not dependent on unix-like /usr/include paths.

Though it would seem that my active directory and the suggested change is the same.

Whenever in doubt, print it:

xcode-select --print-path
xcode-select -p

Read the man page: man xcode-select for more.

| improve this answer | |
1

Assuming your Xcode.app is installed in /Applications you can just run

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

to fix this.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .