Xcode 4 "Clean" vs. "Clean Build Folder"

Objective CIosXcodeXcode4

Objective C Problem Overview


You come at a certain point in the development of every app that what you see in the simulator does not match what you think should happen. Mostly these are human errors -- or at least they are in most of my cases ;-) -- but sometimes Xcode has just 'lost track', or so it seems. I've learnt that the Clean (Shift+Cmd+K) and Clean Build Folder… (Option+Shift+Command+K) menu options can show the difference between your error or Xcode's.

My question though is:

>What does the Clean command do or not do, which leaves a reason for Clean Build Folder… to exist? When should I pick one over the other, why not just always clean the whole folder?

Objective C Solutions


Solution 1 - Objective C

If you select Clean from the Product menu, XCode will delete the files inside every folder in the Build folder, if you select Clean Build Folder it will delete the entire Build folder.

After Clean command:

![enter image description here][1] [1]: http://i.stack.imgur.com/OV18f.png

After Clean Build Folder command:

enter image description here

I think you should select Clean Build Folder when you want to build a binary that you want to release to the AppStore, when you messed up with your project or when your app doesn't work for an "unknown" reason, otherwise use Clean.

I hope I've answered your question :D

Solution 2 - Objective C

Clean… cleans the folders for the current selected target.
Clean Build Folder… cleans the folders for all the targets.

Solution 3 - Objective C

As of Xcode 10, 'Clean' has effectively disappeared. Apple says here:

"The new build system uses the "clean build folder" behavior. The legacy "clean" behavior is not supported".

Solution 4 - Objective C

If you select "Clean", Xcode will delete files inside every folder(e.g., Products, Intermediates) in the Build folder, for the current target. Files for other targets remain.

If you select "Clean Build Folder", Xcode will delete the entire Build Folder, so nothing left.

In most cases "Clean" will work for "unknown" reasons, but you still have to "Clean the Build Folder" because Xcode won't delete files in the include folder inside Products folder.

Solution 5 - Objective C

Some files at ~/Library/Developer/Xcode/DerivedData/xxx-ABCD, where xxx is the name of your project or workspace, have been deleted after you Clean or Clean Build Folder.... Obviously, Clean Build Folder... will delete more files than Clean will do. However, I think deletion of the folder that I mentioned before is needed in some case, such as your Xcode cannot work properly.

By the way, something has changed for Xcode 8, Build folder is kept all the same after Clean Build Folder...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionepologeeView Question on Stackoverflow
Solution 1 - Objective CAluminumView Answer on Stackoverflow
Solution 2 - Objective COliverView Answer on Stackoverflow
Solution 3 - Objective Cuser3806037View Answer on Stackoverflow
Solution 4 - Objective CMindyView Answer on Stackoverflow
Solution 5 - Objective CDawnSongView Answer on Stackoverflow