Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to speedup xcode builds without any project modifications?

Last version or XCode (3.2.1) is running very slow on OS X 10.6.

What kinds of tweaks can you do to your Mac in order to speedup Xcode build process.

I'm not looking for general hints like how to restructure your projects, just tweaks that are related to environment.

For example I remember that on Windows for Visual Studio two significant speedups are to disable antivirus and NTFS last access time.

So I'm aiming at something else than: hardware upgrades, project structure modifications or configuring distributed builds.

Update #1 - maybe limiting the number of cc1plus processes could help speeding up. I think there is an environment variable that can be used for this but I wasn't able to relocate this info.

like image 424
sorin Avatar asked Feb 05 '10 17:02

sorin


People also ask

How long does an Xcode build take?

On a latest-generation machine, the same project may take around two minutes to compile. Also, Xcode uses a lot of RAM to operate.

What is incremental build Xcode?

'Incremental' says to compile only the files that are modified and 'Whole module' denotes to build all files in the project irrespective of the changes made. Action Points. 1. Goto 'Compilation Mode' in build settings. By default, Xcode 10 should have set it to 'Incremental' for Debug and 'Whole Module' for Release.


2 Answers

I think I may got Xcode to build at decent speed with this command:

# Xcode 3.x
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4

# Xcode 4.x
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

This will limit the number of processes executed when it does build. Before adding this to my machine (4 cores/3GB RAM) the build process was slower than on single core!

I think that XCode is not able to estimate the right limit of subtasks by itself because it does the estimate by looking only at your number of cores and ignoring the amount of RAM you have.

like image 69
sorin Avatar answered Oct 03 '22 01:10

sorin


For Xcode 4 this is now:

defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

like image 22
Tamer Avatar answered Oct 03 '22 00:10

Tamer