Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use xcodebuild in command line?

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).
like image 718
Spark Avatar asked Mar 02 '12 02:03

Spark


People also ask

How does Xcodebuild work?

Overview. The Xcode build system manages the tools that transform your code and resource files into a finished app. When you tell Xcode to build your project, the build system analyzes your files and uses your project settings to assemble the set of tasks to perform.

How do I run command line arguments in Xcode?

Open your scheme (⌘<) and select the Run > Arguments tab. Add the arguments you want to pass on launch one at a time. Double-click to edit any argument: The arguments are vended by CommandLine.

What is Xcodebuild?

xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project. Usage To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the projectname. xcodeproj package).

Where is Xcodebuild?

It should by located in: ~/Library/Developer/Xcode/DerivedData . Save this answer.


2 Answers

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

like image 188
Juan Enrique Muñoz Zolotoochin Avatar answered Oct 16 '22 15:10

Juan Enrique Muñoz Zolotoochin


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
like image 23
Conrad Shultz Avatar answered Oct 16 '22 16:10

Conrad Shultz