where is the root of the Xcode app project directory located? - xcode

I'm following a app tutorial and it says:
"Next, create an empty file in the root of the Xcode app project directory and call the file Podfile. Open it with your favorite text editor and paste the following line in it:"
I'm confused exactly where this is? is it inside my Xcode program? or is it some folder inside my Xcode folder in finder?

Got it.
Open Terminal, navigate to the directory that has your project. Type it like this:
cd ~/Path/To/Folder/Containing/yourProject
I saved mine on my desktop so it was simple.
Then type: pod init
This creates the pod file.
Then type:
open -a Xcode Podfile
This will open the file so that you can edit it.

You should do it in Terminal.
Once in Terminal:
type cd (there is a space after cd)
drag your project to the Terminal window and press return. It points Terminal to your project.
type touch .Podfile, which will create an empty file in your project
type open -a TextEdit .Podfile, which will open the .Podfile file in TextEdit
paste your code in it and then save.
you can check that your Podfile has been created by typing ls -a in Terminal, which will show you all files and folders in your project
This should work.

Related

copy and paste any file in Xcode Workspace

I have opened a workspace in Xcode, now how are you suppose to copy paste a file.. Using keyboard Command+c/v does not work?

build folder missing in Finder on Mac after npm build

After running npm run-script build the build folder is not visible in Mac Finder.
But the folder is there, as seen via Terminal window ls command.
How can I get the folder to display in finder?
The build folder might be hidden. You can try pressing cmd + shift + . in Finder to turn on showing hidden folders.
You might have opened Finder in the wrong folder. Try running open . in the terminal where you ran ls in. That will open Finder in the correct folder.

how to open a file in vscode through a terminal?

I want to open a project folder using terminal.
when type the command .code in terminal it open up vscode but the folder is empty and there is no file.
obviously I can open it with right-clicking and open with code but is there a way i could open it through terminal?
I'm running Ubuntu as my operating system.
You have to use cd to enter in the folder that you want to open in vs code.
After that you just need to use code . and it will open the current folder in vs code.

xcode command line app - where is the executable code?

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.
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.
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
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.
"Find" works, but you could also view the build log output and look for "CreateBuildDirectory" and copy the path from there.
Example below:
In Xcode 14 the path is nested under the line that says "Create build directory $(DERIVED_DATA_DIR)", but you can see the full path by expanding the icon on the right of the output.

Where does xcode resolve "$(BUILT_PRODUCTS_DIR) to on my system?

When Compiling for iPhone Simulator with Xcode 4.2, if I place
"$(BUILT_PRODUCTS_DIR)"
in
Build Settings / Header search paths / Debug
and exit editing I can see it resolves to:
"build/Debug-iphoneos"
Where should this be on my system? I have looked in:
Library/Developer/Xcode/DerivedData/{Project Name}/Build
but I can't find a file called build that contains a folder called Debug-iphoneos.
On my system, compiling an OSX project, that resolves to an absolute path:
BUILT_PRODUCTS_DIR /Users/andy/Source/MyProject/build/Debug
There are so many Xcode build variables that I keep a text file with a sample list of them which I got from executing a custom build script and viewing the output within the log tab.
If your code is going into the Library folder, then that is hidden under Lion. You can unhide it from the command line (Terminal) using:
$ cd ~
$ chflags nohidden Library
You should then be able to see its content.
Another tip: I have a ~/tmp folder where I let temporary stuff accumulate and I have set my Xcode preferences to put DerivedData and Archives into that folder so I can:
delete it now and again (I don't like temporary stuff accumulating where I cannot control it).
see it for packaging pre-release Archived project to testers.

Resources