How to disable indexing in Xcode 4?

Solution 1:

Open a terminal window and paste this command:

defaults write com.apple.dt.XCode IDEIndexDisable 1

You'll lose some features (autocomplete, jump to definition, some of the assistants won't work right). But you'll gain back ram and cpu.

For my project Xcode went from using 2 Gigs to a few hundred MB. (which I sorely needed to compile with ;))

Solution 2:

Reducing the priority of the XCode process helps:

renice 10 -p PID

You can get the PID from the Activity Monitor or top/ps commands.

Solution 3:

This problem has been noticed on this newsgroup:

The crux of it seems to be that XCode4 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.

I'm guessing apple's internal engineers were all rocking maxed-out mac pros or something.