Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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/`
--->  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 
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
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
up vote 8 down vote accepted

Did you run sudo xcode-select -switch /Applications/ 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 bundle which is in /Applications.


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

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

As stated here, you need to run:

sudo xcode-select -switch /Applications/
share|improve this answer
// , 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/, or, in the case of Xcode Beta users, just sudo xcode-select -switch /Applications/ Why does this answer add the additional /Contents/Developer? – Nathan Basanese Nov 30 '15 at 17:46

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

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

share|improve this answer

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
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
// , This is an interesting idea, @Serj. May we know more? – Nathan Basanese Nov 30 '15 at 17:48

Your Answer


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.