90

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.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
FarMiaplacidus
  • 901
  • 1
  • 7
  • 3

7 Answers7

108

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 ;))

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Dave
  • 1,087
  • 1
  • 7
  • 4
  • 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. – clemahieu Aug 18 '11 at 04:14
  • 11
    Wow. 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. – Nate Jul 23 '12 at 21:56
  • 4
    Hahahaha, 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… – Potatoswatter Aug 17 '12 at 09: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. – ArtHare Oct 25 '13 at 22:39
  • Wow awesome! When you use vim as an editor anyways, this is perfect. – elimirks Dec 17 '13 at 17:27
  • For me what worked was to shut down a lot of other Mac apps I had opened (Excel, Powerpoint, multiple browsers). Then the Indexing Paused message went away and I was able to quickly start up my app in Xcode. My configuration is Mac 0S 10.9 with 8 gb RAM. – Jazzmine May 26 '14 at 20:11
  • `open -a xcode --args -IDEIndexDisable 1` can be used to temporarily disable it. no need to write defaults – SolaWing May 03 '19 at 01:03
8

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.

Peter Tseng
  • 13,613
  • 4
  • 67
  • 57
  • 3
    This 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. – Peter Hosey Feb 08 '12 at 08:45
  • 1
    True, 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. – Peter Tseng Feb 21 '12 at 19:16
7

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.

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
  • 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. – lericson Oct 23 '14 at 14:41
1

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.

Damian Carrillo
  • 1,218
  • 9
  • 11
  • 1
    Also, 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. – Damian Carrillo Aug 31 '12 at 20:03
1

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.

Jim
  • 11
  • 1
0

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.

dar512
  • 862
  • 8
  • 18
  • Did you ever figure out why it takes so long on your Macbook Pro? I seem to be having the same issue. – chown Aug 06 '12 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. – dar512 Feb 28 '13 at 21:23
-7

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.

Chris Hanson
  • 54,380
  • 8
  • 73
  • 102