17

I was had to reinstall Xcode 4 and now I'm getting message Xcode appears to be installed but xcodebuild is unusable; and xcodebuild exists but failed to execute all the time when I try to install anything using ports:

ash-3.2$ sudo port install wget
Password:
Warning: xcodebuild exists but failed to execute
Warning: configured user/group adm does not exist, will build as root
Warning: Xcode appears to be installed but xcodebuild is unusable; some ports will likely fail to build.
Warning: You may need to run `sudo xcode-select -switch /Applications/Xcode.app`
--->  Computing dependencies for wget

xcodebuild exists but it wants to another one xcodebuild or it just wants to be in /Developer folder?

$ which xcodebuild
/usr/bin/xcodebuild

$ /usr/bin/xcodebuild 
error: can't exec '/Developer/usr/bin/xcodebuild' (No such file or directory)

What's wrong with this utility? How can I fix it (I've already reinstalled Xcode)?


Update: port worked fine even without xcodebuild, I think MacPorts uses make and it showed this message just to make me know that I may have a problems with Xcode.

That's interesting. I've tried … xcode-select … but for some reason it newer worked even after reboot, but today it worked :|. It asked me if I want to accept the license agreement and after I accepted it xcodebuild become functional. So now I can accept answer and thank everybody.

5
  • 2
    As far as I know, XCode 3 was installed in /Developer, but XCode 4 is installed as an Application in /Applications. (I haven't installed XCode 4 yet) Are you sure XCode 3 was properly uninstalled?
    – CoffeeRain
    Commented Mar 28, 2012 at 14:19
  • I've never had Xcode 3 on this computer. I've reinstalled Xcode 4 from App Store after removing older Xcode 4 which didn't wanted to start. Commented Mar 28, 2012 at 14:29
  • You might try what SSteve suggests. My guess is that there is a file somewhere that thinks that you have XCode 3 installed. :|
    – CoffeeRain
    Commented Mar 28, 2012 at 14:42
  • D'oh it was in my question. I've just copied it without looking :( I've ran xcode-select but it didn't hellped yet. Commented Mar 28, 2012 at 14:57
  • Just a tip that’s unrelated to your problem: you may want to use Homebrew instead of MacPorts. Commented Mar 30, 2012 at 8:30

5 Answers 5

23

Did you run sudo xcode-select -switch /Applications/Xcode.app? This message: error: can't exec '/Developer/usr/bin/xcodebuild' is telling you that your system is looking for xcodebuild in `/Developer/usr/bin/' but as of Xcode 4.3 (the one that's installed from the App Store) it's located in the Xcode.app bundle which is in /Applications.

Edit

In a comment to your question you say you've run sudo xcode-select -switch /Applications/Xcode.app. Now run xcode-select -print-path and make sure it says "/Applications/Xcode.app".

Also, you may need to download the command line tools separately. (I don't know from first-hand experience because I'm stuck on Snow Leopard for the moment so I haven't installed Xcode 4.3.)

0
9

As stated here https://trac.macports.org/wiki/ProblemHotlist, you need to run:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
1
  • // , Thanks for the command and the link, @Gabriele Bartolini. I had a question, though, to which I hope you might know the answer. Why not just sudo xcode-select -switch /Applications/Xcode.app, or, in the case of Xcode Beta users, just sudo xcode-select -switch /Applications/Xcode.app? Why does this answer add the additional /Contents/Developer? Commented Nov 30, 2015 at 17:46
5

I had the same problem. After upgrading to Mountain Lion and upgrading Xcode to version 4.4.1 including the command-line tools, I could not call xcodebuild from the terminal anymore.

Then I stumbled upon a setting in Xcode's preferences where I had to choose which command-line tools I wanted to use, a bit silly since there were only one option.

enter image description here

http://thomas.bindzus.me/2012/08/17/after-upgrading-to-mountain-lions-problems/

I found this to be the easiest way to restore my command-line tools.

1

you need to create simple "mac os x" project using "command line tools", after that you will be able to download command line tools from xcode->pref's->downloads in components. it's size 115.6MB

2
  • 1
    Can you describe in a bit more details what you mean with the first sentence? How would one do that?
    – nohillside
    Commented Dec 15, 2012 at 12:47
  • // , This is an interesting idea, @Serj. May we know more? Commented Nov 30, 2015 at 17:48
1

I had very recently installed Xcode (along with the command line tools) on High Sierra (10.13.4) and I only fixed this error message by accepting the Xcode license via the command line:

sudo xcodebuild -license

You must log in to answer this question.

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