Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
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 Mar 28 '12 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. –  Alex Bolotov Mar 28 '12 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 Mar 28 '12 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. –  Alex Bolotov Mar 28 '12 at 14:57
    
Just a tip that’s unrelated to your problem: you may want to use Homebrew instead of MacPorts. –  Mathias Bynens Mar 30 '12 at 8:30
add comment

4 Answers

up vote 7 down vote accepted

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.)

share|improve this answer
add comment

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

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
1  
Can you describe in a bit more details what you mean with the first sentence? How would one do that? –  patrix Dec 15 '12 at 12:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.