OSX and Indexes
March 07, 2007
I’ve had my iMac G5 for a little over a year now and it’s been a great machine, the best I’ve ever had. (Although that will doubtless change when I make the move to intel later in the year). Just lately though it had seemed a bit sluggish sometimes. Spotlight was starting to appear almost hesitant, pausing when I first started to type and my 4 accounts-worth of mail and 2 thousand(ish) pictures seemed to be bogging down both Mail and iPhoto (respectively).
Thus, I decided some cleaning was in order, the commonality between all of those slow downs being that each was tied into a database.
I began with iPhoto, I wanted to rebuild the thumbnails and also the entire library (I recommend you do a backup in case this goes wrong). You can do this by holding down the command+alt keys and then launching the app. You’re presented with a pretty self explanatory dialogue in which I simply ticked all 4 boxes and then left it to do it’s thing. It takes quite a while, mine took about 30 minutes if not a bit longer but at the end of it iPhoto felt as good as new! It was faster to launch, search, browse and everything.
One down, two to go. Mail was up next and it requires using the terminal but it’s just a case of copy pasting a couple of commands. First make sure you quit mail and I would also recommend backing up your mail folder ( ~/Library/Mail ) just in case something bad happens. Then, fire up terminal and type the following:
cd ~/Library/Mail
sqlite3 Envelope\ Index
vacuum subjects;
It’ll take a minute or two to run depending on how much mail you have, but once it’s done press ctrl+d to exit the sqlite prompt, fire up Mail and enjoy the speed increase! This is also reduces the size of the envelope index (mine was reduced by 10mb).
Finally spotlight, after rebuilding the spotlight index for my system the difference was quite incredible, the index is half the size and results appear instantly, without delay, just how it used to be when I first got the machine.
There are several ways to rebuild the spotlight index, I used a little app called Spotless which works very well. It’s not free though, so here’s the command to run in the termainal:
sudo mdutil -E /path/to/volume
For example sudo mdutil -E / will erase the database on the boot volume (which is probably what you want to do). Shortly afterward you’ll see the little start blinking as it reindexes. It will probably take quite a while depending on how many files you have. I have about 60Gb of data on my boot drive (the rest is elsewhere) and it took about 30 minutes.
So.. if you’re experiencing a bit of a slowdown in any of those apps then it’s worth giving the above a go!
Feedback?
If you’ve found errors or have some feedback please . Comments aren’t currently enabled due to spam but I’m sure they’ll return in the future.