Mac – Xcode appears to be installed but xcodebuild is unusable

macportsxcode

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.

Best Answer

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