How can I use xcodebuild in command line?
Solution 1
The installer put mine in
/usr/bin/xcodebuild
You can also find it in the application bundle:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
Solution 2
/usr/bin/xcodebuild
only calls the xcodebuild
command from the developer tools directory given by xcode-select
. To find out the current developer tools directory as given by xcode-select
run
xcode-select -print-path
I fixed the issue by changing that path executing
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Which is where my developer tools are. You should change /Applications/Xcode.app
to wherever your Xcode application is.
Related videos on Youtube
Comments
-
Spark almost 2 years
I'm a newbie to xcode. I'm using xcode 4.3 with lion. I want to use xcodebuild in command line, but it report "no such file". I searched it with Finder, but no result.
What is this file's path? Does it exist in the Xcode.app? Can I search files in a .app package?
Additional info: When I typed "which xcodebuild", it return /usr/bin/xcodebuild. Enter this folder, and type xocdebuild, it still return Error:
Can't run /Applications/usr/bin/xcodebuild (no such file).
-
Spark about 12 yearsI have checked it, and make sure it installed.
-
Spark about 12 yearsI find it, but still cannot work, aways report: Can't run /Applications/usr/bin/xcodebuild (no such file).
-
Conrad Shultz about 12 yearsPost exactly what you are typing. Note that "/Applications/usr/bin/xcodebuild" is NOT what I wrote, and is a totally bogus location.
-
Conrad Shultz about 12 years(I'm not saying you're messing things up, though. It's possible that you have a broken symlink somewhere, for example.)
-
NSResponder about 12 yearsSpark, look carefully at what you wrote. You're leaving "Xcode.app" out of your path.
-
Spark about 12 yearsI just type "xcodebuild". It seem mac aways redirect my command to a nonsexist path "/Applications/usr/bin/xcodebuild"
-
Conrad Shultz about 12 yearsBut you're saying that "which xcodebuild" results in "/usr/bin/xcodebuild"? Maybe you have a bad symlink... what do you get if you "ls -l /usr/bin/xcodebuild"?
-
Spark about 12 yearsThanks all guys, the problem solved :) The xcodebuild in /usr/bin/xcodebuild is corrupted. I made a link from /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild, it can work now.