Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode command line app - where is the executable code?

Tags:

xcode

I'm writing a small command line tool/app in Xcode 6. After a steep learning curve (that I'm still climbing) I've got my code working in main.m without errors. My question is: does Xcode build some executable code that I can run from the command line inside a Terminal? I've tried "Build" and "Run & Build" but I don't see where any executable code is created. I'm very new at Xcode and need some help. I'm running OS X 10.9.5 and Xcode 6.1.1 on a Mac Mini.

If viewing my code would be useful, let me know and I'll put it up.

Thanks for any assistance.

Kevin H.

like image 202
kjhart0133 Avatar asked Jan 28 '15 20:01

kjhart0133


People also ask

Where is Xcodebuild?

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

What is Apple Xcode command line tools?

The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.

How do I open Xcode on Mac terminal?

Installing Xcode Press “Command + Spacebar” to access Spotlight Search; Type in the word “Terminal” into the Spotlight search field and hit “Enter”; this should execute your Mac's Terminal app; Type “gcc” into the terminal and hit “Enter” (gcc is a compiler that turns source code into executable applications).

What is command line developer tools on Mac?

They allow programmers to compile programs and debug them, convert files, and perform a number of tasks for handling the resources required for making applications and other tools.


3 Answers

It's hidden very well. In Xcode 6, when you build an app, there is a folder "Products" in the project navigator (left pane). The name of your project will be there too. Right click, and select "show in finder". It will show you an obscure folder hidden deep in your OS X Library where the executable is located.

like image 171
Non Plus Ultra Avatar answered Oct 12 '22 09:10

Non Plus Ultra


To copy the executable to a more convenient location each time you compile go into the project settings and select the Build Phase.

Type in a absolute location such as: ~/Documents/dev/temp. (It does recognize ~ as the current users home directory)

Then Press the '+' Button Under the 'Copy Files' Section and Select Your File (Select Your executable under the Products Folder)

Deselect the 'Copy only when installing' button. Then build and it should be at that location.

To launch just open the terminal app and go to that location. The executable should run unless there are dynamic libraries it calls that are not in the lib path.

Hope this helps

like image 28
Patrick Domegan Avatar answered Oct 12 '22 09:10

Patrick Domegan


The binary is in a folder under /Users/Username/Library. Something like:

/Users/<Username>/Library//Developer/Xcode/DerivedData/.../Build/Products/Debug/<ProjectName>

You can easily find it with this command:

find /Users/<Username>/Library/ -name "<ProjectName>"

replace "Username" and "ProjectName" accordingly to reflect your environment.

like image 5
Bemipefe Avatar answered Oct 12 '22 08:10

Bemipefe