How to make Xcode faster by solving Xcode slow issues with xcode 4.x

Disable indexing if you are building out huge projects in Xcode. This can halve Xcode’s memory consumption.

Running Xcode in 32 bit. This is not an option for everyone, because it will exceed 4 GB in larger projects.

Reduce the number of build processes (again).

Restarting Xcode often (It doesn’t do a very good job cleaning up after itself).

Use clang as your compiler. Clang instances in general use less memory than Apple’s GCC 4.2.

Offload dependent targets which do not change often. Example: You will not need to rebuild third party libraries daily in most cases.

Indexing in xcode

Xcode 4 has an entirely new mechanism for indexing files in a workspace. An index is created for the entire workspace, so references across projects are resolved.

The indexer now uses the LLVM compiler 2.0 to parse source files. This results in improved performance and higher accuracy; most importantly, the interpretation of symbols for indexing more closely matches the interpretation of syntax at compile time.

The index is stored in the Index subdirectory of the workspace’s unique directory in ~/Library/Developer/Xcode/DerivedData. Manage this information (including deleting the index and other derived data of an orphaned project) in the Organizer.

Indexing is done in the background; the Activity View indicates when indexing is being performed. Until the index is ready, some functions that require the index may not be available (for example, Open Quickly); others may have degraded performance (for example, syntax coloring of system symbols). When the index is complete these features become available immediately.

it seems to be that XCode4 and 4.1 uses crazy amounts of Ram during indexing – like, 5gb or so(!), and thus if you’re on a machine with something like 12gb, there’s no problem, but if you’re on a laptop with only 2gb or so, you’ll have some pretty severe paging going on.

How to disable indexing

Open the Terminal window , then type the following code in terminal and click enter.

defaults write com.apple.dt.XCode IDEIndexDisable 1

Now restart your xcode and enjoy better performance.

How to Enable xcode indexing

if you upgraded your machine or you want some other features to be turned on if you need indexing service, please follow the steps below.

Open the Terminal window , then type the following code in terminal and click enter.

defaults write com.apple.dt.XCode IDEIndexDisable 0

(or)

defaults delete com.apple.dt.XCode IDEIndexDisable

While you’re at it, you should delete the key you added as well:

defaults delete com.apple.dt.XCode IDEIndexEnable

Now restart the xcode now you can see the indexing will start from now on wards.