We got a copy of Mac OS X Tiger a month or two ago at work on one of the latest dual-processor G5's. Tiger seems to run faster than the other workstations in the shop, that are all running Jaguar, and once you've used spotlight a few times, it's hard going back to the old search tool.
We've run into a problem with Tiger that we don't have with older versions of OS X, namely, after extensive use of spotlight, Tiger crashes and on reboot hangs with just the spotlight icon visible on the desktop and nothing else. For those of you who already know what I'm talking about, the little icon above looks all too familiar.
When this first happened, I assumed that maybe it was just a bad install, or something in the system had gotten corrupted. During the troubleshooting process I first got ahold of the latest Norton utilities and tried to repair the disk. After the interminable wait of Disk Doctor and Speed Disk, the problem remained after reboot.
Next, I tried to use the Tech Tool Pro utility that shipped with the new G5. It checked the RAM, the CPU, the hard drives, well, practically every piece of hardware in the machine and came out with a clean bill of health. After reboot, the machine came up and hung at exactly the same point as before, only displaying the Spotlight icon, taunting me.
At this point, I decided that, surely, the install was bad so I went to the boss and informed her that it'd probably be best to back up user files and just reinstall the OS. So, I did that, and a week later, when the same problem popped up again, it occurred to me that it probably wasn't the install.
Just in case the problem popped up again, I decided to format the drive into two partitions and install the OS and applications on both partitions. This way, if the problem popped up on another shift, the operator could reboot into the other partition and still get some work done until I could come in and figure out how to fix the problem. Only thing was, I still had no idea how to fix the problem.
So, google to the rescue.
It would appear, contrary to the cult of mac, that there are a whole slew of problems with OS X, I just happened to be running across one of the latest of many. The first solution to try is to reboot using the install disk and run the First Aid portion of the Disk Utility.
For those of you new to Macs, in order to boot from a CD when you can't login to the system to specify which volume to boot from, insert the disk, reboot the machine by either holding the power button til the machine shuts down and then hit it again to start it up, or unplug the damn thing and then plug it back in, hold the "C" key while starting up and it'll boot off the CD.
When the installer menu comes up, hit the Utilities option in the Apple menu bar, and select Disk Utility. When the Disk Utility window comes up, select the First Aid tab. In the First Aid tab, select the boot volume and click the button that says "Repair Disk". Do this as many times as it takes until the scan comes up all clean.
Okay, now that we now how to run the disk utlitiy, let me save you some time and tell you that it doesn't fix the problem. Why would I possibly include the step? Because it does fix a number of other problems, so it's a good piece of information to keep in the back of your mind the next time a problem pops up in OS X. Also, I'm relating the steps I took in order to fix the problem, and this is one of those steps.
So, since the Disk Utility didn't fix the problem, back to google I went to see if there was anything else I could try. Lo and behold, the mighty fsck.
For those of you who don't know, OS X is built on top of BSD, which is a free version of System V UNIX. UNIX has it's own filesystem checking tool, fsck (i.e. FileSystem ChecK). In order to run fsck in OS X, you need to reboot into single user mode, you can do this by shutting down the machine and while booting back up, hold down both the command key (the Apple key, or the cloverleaf key, depending on the keyboard that shipped with your Mac) and the "S" key--simultaneously. That means, hold down both keys, at the same time, while the computer is booting up.
For you longtime Mac users, this is going to dump you into a commandline. Now, I know that this might be scary to a few of you but, stick with me and it'll all be over soon.
Once you're at the commandline, type fsck -y and hit the enter key. The system will scroll some text by, if there were any problems fixed, you'll see **** FILE SYSTEM WAS MODIFIED *****. Run fsck -y again until that message doesn't pop up anymore. Once that message no longer appears, reboot the system.
Okay, once again, this step also doesn't fix the problem, so I had to sit and think for a minute how to frame my query before I went back to google to search for a solution. The computer seems to boot fine, automatically logs in to the default user, the user desktop shows up, well, actually, only the wallpaper and just the spotlight icon portion of the Apple menu bar. It's like it never gets past loading spotlight and just stalls out before the desktop loads completely...Hey!
The answer was right there in front of me from the get-go, spotlight is the reason that the desktop isn't loading completely. It occurred to me, then, that maybe the spotlight database was getting corrupted somehow but I didn't know how to fix it. So, with a much clearer idea of what I needed to fix, back to google I went.
As it turns out, there are quite a few people who are having this exact same problem. In order to rebuild the index, it's easiest to first wipe the main spotlight index and then let the OS rebuild it from scratch. In order to do this, you'll need to boot into safe mode. You can boot into safe mode by holding down the shift key while the computer is booting up.
Ironically, the computer seems to run perfectly fine from safe mode. The default user can log in and do everything that they can normally do, from what I could tell. Rebooting normally, without fixing anything, will still give you the same previous sorry state of things, so before we do that...
Open the terminal.app. Now, I know we're going back into the commandline, but the last forray wasn't so bad, was it? This'll be no different, trust me. Once you have terminal.app open, type sudo mdutil -E /. It'll ask for a password, just enter the password for the account you're logged into. If you don't have permission to run sudo, the prompt will bark at you and go back to the prompt. However, you can, alternatively, just log into root. The latest versions of OS X has root disabled by default but, you can enable root through the Netinfo manager.
Open the Netinfo manager, which looks like a proprietary Apple control, but really, it's just a pretty interface to LDAP, which a lot of you are probably pretty comfortable with. Anyways, open the Netinfo manager, click the lock and authenticate. Click the Security option in the menu bar and select "enable root user". It'll ask you to create a root password, please pick a non-trivial, alpha-numeric, mixed-case password. I know you're not gonna do it, but at least I warned you.
Okay, so, if you weren't able to run sudo mdutil -E / before, go back to the terminal and type su to switch to the root user. You'll be prompted to enter the password you just created, do that and when you get control of the prompt again type mdutil -E /.
In 99.9% of the cases, this will fix the problem. Reboot and see if this fixed the problem for you. If this doesn't work, you'll have to do something a little more drastic.
Reboot again into safe mode. After you log in, navigate to your home directory, then go into Library > Preferences and find com.apple.spotlight.plist. Drag the file into the trash and empty the trash. OS X will regenerate the file on reboot and everything will be kosher. If you've been keeping up with upgrades, you might not have com.apple.spotlight.plist, in that case, throw out com.apple.finder.plist, empty and restart.
It's been a couple of months since I've tracked down the fix for this problem and I can't seem to find the forum posts where I located the solution. If I remember correctly, a member of one of the forums mentioned that Apple doesn't acknowledge that spolight craps out like this. Just a warning, about every two weeks or so, spotlight screws the pooch again. Maybe this'll get fixed in one of the upcoming system upgrades. Kinda doubt it since it hasn't been addressed thus far.
At least you know how to fix it now.
Update -- January 8, 2006
Tim writes:
I saw your article and wanted to pass on my experience - I ran into the same problem almost immediately after upgrading to Tiger (when it came out.) I have also seen it on a OSX Server install.
The solution I found was to boot the Mac in safe mode (holding down the Shift key on boot.) This fixed the problem by touching the spotlight preference file...
I'll try your command line method next time - but I thought you might like to know this method.
Tony writes:
I've had this problem forever on both my PowerBook and desktop G4 (500Mhz dual) but it was finally fixed in 10.4.3 - so be sure to update the system.
The fix you mentioned may work for a week, but the problem comes back, I know because once I thought I had it licked but it came back a few days later.
Paul writes:
I was reading about your problems with the spotlight index in MacOS X.
I support and manage many Macs, although I've heard of the problem only once before from a fellow admin, I've never seen it. The problem was ultimately solved by swapping out RAM, seems that flaky RAM was contributing to the Spotlight index corruption.
More to the point, avoid the command line for fixing minor problems like yours.
A shareware utility, Onyx, will fix your problem and many other little preference and cache quirks.
If all you want to do is delete the Spotlight index, you'll find that under the "Maintenance" window.
Also, DON'T USE NORTON UTILITIES.
There is no version of Norton Utilities that is compatible with Tiger. (And it isn't fully compatible with Panther either.)
It can and will DAMAGE YOUR DIRECTORY.
Symantec discontinued Norton Utilities and Disk Doctor for Mac some time ago. Symantec still supports and releases Antivirus for Mac, but it has problems. (If Norton Antivirus is installed, it probably corrupted your Spotlight index.)
For Mac antivirus protection:
Tim, Tony and Paul all bring up some good points and I'd like to address a couple of them.
As far as Tony's suggestion about upgrading to 10.4.3, that has fixed the problem for the most part. It doesn't hang as frequently as it used to, but I did have to trash the preferences again right before Christmas vacation
As far as Paul's admonition about not running Norton's, it's corporate policy where I work, as far as I understand it. I'm of the opinion that we should start using DiskWarrior instead, which I've heard great things about, but have never personally used.
In any event, I thought I should just put the information out there, just in case it might help somebody out.
Posted by Philip McClure in Computing Woes Mac on January 07, 2006