Not a long time ago I updated Xcode to version 4. This new version spent a lot of time on indexing the project (it's quite large). That's why I would like to disable indexing. Searching through Xcode help and internet gave no results.
7 Answers
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 ;))
-
This fixed the issue for me as well. On a moderate sized project one day XCode 4 decided to eat 10GB of virtual memory, I only have 4 GB physical, and sat there spinning for 5 minutes. Every time I tried to start up XCode again it did the same thing. Deleted the workspace file, still the same thing. Disabling indexing using this command addressed the issue. Aug 18, 2011 at 4:14
-
11Wow. Losing the ability to show quick help by clicking on a class or method name is kind of a showstopper for productivity. Xcode 4 sucks royally :( ... good answer, though.– NateJul 23, 2012 at 21:56
-
4Hahahaha, for me the show already stopped. When I added the C++ Eigen library, the indexer completely choked and all jump to definition, etc stopped working, even during the brief moments when it stopped indexing. Seriously, do they even test this software… Aug 17, 2012 at 9:04
-
It is difficult to describe the improvement after disabling indexing on my mac pro. I can now freely browse my project. Pre-disablement, it took seconds to simply enter one character.– ArtHareOct 25, 2013 at 22:39
-
Wow awesome! When you use vim as an editor anyways, this is perfect.– elimirksDec 17, 2013 at 17:27
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.
-
3This won't help if the problem is memory usage. Xcode will still consume the same amount of memory; it'll just be using it longer. Feb 8, 2012 at 8:45
-
1True, but it does free up CPU cycles for other tasks. I switched back to XCode 3 for the time being, but I'll have to try 4 with indexing disabled sometime. Feb 21, 2012 at 19:16
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.
-
Sadly, this seems to be very true! You would think they could somehow lessen the in-memory capacity requirements. What happens is that your computer runs out of primary memory and starts swapping. Not pleasant, even with an SSD.– lericsonOct 23, 2014 at 14:41
I ran into either the same problem or something similar. My project includes heavily templated C++. Including those headers in the PCH file solved the problem for me.
-
1Also, deleting the application-specific directory in ~/Library/Xcode/DerivedData/ would allow Xcode to reindex. This would help the situation because indexing seemed to silently fail and not be able to recover. Aug 31, 2012 at 20:03
My new retina Macbook pro running XCode 4 was extremely slow doing indexing (and everything else). My Mac mini at home was very fast working on the same project!? Turns out it was my anti-virus software - doing a scan of every file read or written on the MacBook. Turning that off sped everything up by a ton.
Slow indexing is not a given. And more memory isn't necessarily better.
I have a medium sized project for work ~ 500 source files. After deleting the derived data, it takes 18 minutes to finish reindexing this project. That's with no other apps open and not doing anything else with the computer. This is on a fairly recent Macbook Pro with 8G of memory and an i7. Horrible, right?
My home machine is a recent Mac Mini with 4G of memory and an i5. On that machine the exact same project takes 40 seconds to completely index.
I don't yet know what the difference is, but I'm working on it.
-
Did you ever figure out why it takes so long on your Macbook Pro? I seem to be having the same issue.– chownAug 6, 2012 at 19:40
-
Sorry this is late, I just noticed it. Yes I did, it was the Norton virus checker. Once it was removed, the times were spectacularly better. Our company has since moved to Clam.– dar512Feb 28, 2013 at 21:23
It's not possible to disable indexing in Xcode 4. Many of the IDE's features are built on top of the index it maintains.