Where is Xcode's build folder?
Asked Answered
R

10

238

Before Xcode 4 the build used to be created in the root folder of my project. I can no longer find it.

Where can i find the build folder?

Richerson answered 10/5, 2011 at 15:45 Comment(2)
Click on FILE->PROJECT SETTINGS. It tells you the folder there. Note the small "arrow" button - it will open the folder for you in finder. Very handy.Wigfall
Seems to have been updated to File -> Workspace Settings.Perkoff
F
301

~/Library/Developer/Xcode/DerivedData is now the default.
You can set the prefs in Xcode to allow projects to specify their build directories.

Fenton answered 10/5, 2011 at 15:50 Comment(6)
Ok, so my build goes into the .../XCode/DerivedData/ folder, simple enough. Except that the subfolders seem to be AppName-asdflkjqwergoobledygook. Since I'm building from a script, I'd like to actually find the build (so I can package it and send via TestFlight :) How do I determine which of the many MyAppName-xxxx-s is the right one? Thanks! (Note to Heath: in this particular case, I don't want to force output with the CONFIGURATION_BUILD_DIR parameter, as it messes-up legacy target dependencies.)Tremolant
You can find the setting in Xcode Preferences > Locations > Derived DataPrittleprattle
Build results isn't normally version controlled, so this may actually be an improvement for other IDEs to pick up.Calzada
I like it tbh. No messing about excluding obj bin folders from version control this way. Only problem is finding it, but...google.Amethist
@ArneEvertsson is there any version control system on this planet that doesn't offer a way to ignore build directories? Like.. even a single one?Tweak
@Tremolant This is correct. It will generate hashes as directory names. To find your specific build just make a note of the time you ran the build output and look at the last modified date either in Finder or with ls -l over bashBedstraw
S
35

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

If you changed the defaults, you can see where the build directory is by going to File->Workspace Settings then look at Build Location

Sclerenchyma answered 10/5, 2011 at 15:51 Comment(0)
S
16

You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.

Source: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/0-Introduction/introduction.html#//apple_ref/doc/uid/TP40003931-CH1-SW1

Squamous answered 31/8, 2011 at 16:4 Comment(1)
Excellent. Is there a variable that tells the name of the output folder if I just let XCode do it's thing? (I mean the random-text after the app name in .../Xcode/DerivedData) Thanks!Tremolant
M
11

enter image description here

enter image description here

Configure XCode project settings, it can solve your problem.

Mercorr answered 18/9, 2018 at 12:37 Comment(1)
Legacy Build System is deprecated!!!Nisbet
T
11

Xcode build folder

Workspace

By default Build location is in Derived Data.

Please note: a path to a product can be changed if you delete DerivedData during development process and rebuild it again.

Xcode -> Preferences... -> Locations 

You can change the location of Build location. It will have an effect on the whole workspace

File -> Project/Workspace Settings... -> Advanced 

Target

CONFIGURATION_BUILD_DIR

If you want to create an autonomic Build location for a target you can change the location:

Xcode v11 and above

Add User-Defined Setting -> CONFIGURATION_BUILD_DIR

Xcode pre v11

Project editor -> select a target -> Build Settings -> Per-configuration Build Products Path (CONFIGURATION_BUILD_DIR) 

//default value
$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)

You can get next error[About]

Command CodeSign failed with a nonzero exit code
Tellurize answered 15/8, 2019 at 15:25 Comment(0)
S
5

I wondered the same myself. I found that under File(menu) there is an item "Project Settings". It opens a dialog box with 3 choices: "Default Location", "Project-relative Location", and "Custom location" "Project-relative" puts the build products in the project folder, like before. This is not in the Preferences menu and must be set every time a project is created. Hope this helps.

Schluter answered 24/5, 2017 at 22:30 Comment(2)
Hey, welcome to stackoverflow. Looks like it's an old question and already has an answer. You are all welcome to post your answer, if you think your answer is different and better than the others. I suggest you to please add 'how your answer is different/better' than others. This will help users distinguishing it from other answers.Schuler
Amit, this answer includes better detail on what the GUI shows currently, which differs from prior.Halda
K
3

With a project previously created in Xcode3, I see an intermediate directory under build/ called Foo.build where Foo is my project's name, and then in that are the directories you'd expect (Debug-iphonesimulator, Release-iphoneos, etc, assuming you've done a build of that type) containing the object files and products.

Now, I suspect that if you start a new project in Xcode4, the default location is under DerivedData, but if you open an Xcode3 project in Xcode4, then Xcode4 uses the build/ directory (as described above). So, there are several correct answers. :-) Under the File menu, Project Settings, you can see you can customize how XCode works in this regard as much or as little as you like.

Knickers answered 10/5, 2011 at 15:51 Comment(0)
O
2

In case of Debug Running

~/Library/Developer/Xcode/DerivedData/{your app}/Build/Products/Debug/{Project Name}.app/Contents/MacOS

You can find standalone executable file(Mach-O 64-bit executable x86_64)

Obsecrate answered 26/12, 2015 at 12:43 Comment(0)
A
1

For me it was under:

/Users/{your username}/Library/Developer/Xcode/DerivedData...

and NOT in /Library/Developer/Xcode/DerivedData...

Abirritate answered 11/6, 2020 at 23:36 Comment(0)
C
1

You can change the build directory using the project settings, but those settings don't seem to be saved in the shared settings, so it's hard to get them into source control, which makes it difficult to create automated builds that get everything from source control first.

My fix: add scripts to the project to copy the built files to wherever you like. Select the target in Xcode (these instructions are for Xcode 12): click on the file icon in the top left to open the Project Navigator, then on the project name next to an Xcode icon, then on the target in the right-hand pane. Now click on the Build Phases tab, then on the little plus sign, then on 'New Run Script Phase'.

You can type in a script which should be something like this:

cp -R ${BUILT_PRODUCTS_DIR}/MyProduct.framework ${PROJECT_DIR}/MyProduct.framework

This example is for a framework project, so it copies the whole framework directory to the project directory (where your .xcodeproj file lives). Now, when you build on the command line using xcodebuild, your built product will be in a known place.

Confessional answered 2/4, 2021 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.