Thursday, March 17, 2011

How to really disable spotlight and save your old mac

I have one of the first generation of Mac Book Intel. This machine has been working really good for the past five years.
Since I bought it I've been steadily upgrading it with more RAM and faster and bigger hard-disk.
With the last hard-disk, I was happy to have all my 500Go desktop files with me, everywhere I go.
But with Snow Leopard and a bigger hard-disk came the problem of the dreadful mds process. It was just dragging my 1.8 MHz duo core to its knees; until the whole laptop overheat till reboot.
So I figured out it was related to spotlight which I never used (I much prefer the unix commands to do complicated searches).
And suddenly came Snow Leopard 10.6.6. which made removing spotlight much harder...

So if you have a old mac laptop you don't want to trash with a lot of files and you don't know what is spotlight, this is what you should do:

1 - enable the superuser (root) account (by doing this)

2 - start a unix terminal Applications>Utilities>Terminal

3 - verify the mds process is the reason why your computer is overheating by typing
top -o cpu

into the Terminal. If it shows 100% and stay like this for too long (5-30mn) it means this process should be disabled

4 - create a nomds.sh script that turns spotlight indexing off
#!/bin/sh
mdutil -a -i off


5 - run this script (nomds.sh) as root
login root
(type your password)
chmod 755 nomds.sh
chown root nomds.sh
mv nomds.sh /usr/bin/
nomds.sh

should be enough (Terminal prompting "Indexing disabled.") if you run osx prior to 10.6.6. But on 10.6.6 mds is like a phoenix always coming back even after you ask the system to uninstall it. So I added a daemon that just kill it every minutes. To do so:

6 - add a launchd plist in /Library/LaunchDaemons/. Call this file com.devdaily.nomds.plist

and copy/paste the following text into it

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>label</key>
<string>com.devdaily.nomds</string>

<key>ProgramArguments</key>
<array>
<string>/usr/bin/nomds.sh</string>
</array>

<key>OnDemand</key>
<false/>

<key>Nice</key>
<integer>1</integer>

<key>StartInterval</key>
<integer>60</integer>

<key>StandardErrorPath</key>
<string>/tmp/AlTest1.err</string>

<key>StandardOutPath</key>
<string>/tmp/AlTest1.out</string>
</dict>
</plist>



Now reboot, or if you don't want to reboot run
launchctl load /Library/LaunchDaemons/com.devdaily.nomds.plist


You should never be bothered by splotlight anymore.

I know it sounds a bit brutal to force the system like this, there might be a way to do the indexation good once and for all, or disable it gently, but as I said above I don't use any of this features, so this was the fastest and most acceptable solution I came with.

If you know what you're doing you can use this technique for a lot of other annoying processes, like all those from Adobe, but this is another matter.

Labels: , , , , , ,


This page is powered by Blogger. Isn't yours?