Your Mac slow? Disable Spotlight in Snow Leopard
For some time now I’ve experience my mac to be very slow. Opening Vim would take minutes. Creating a new Tab in iTerm would take more than 20 seconds. What the hell is going on - this is a brand new MacBook Pro! ~ After investigating, using Activity Monitor I discovered the following:
- CPU’s idling at 3-5% usage
- +500M free RAM
- +200G free disk space
- Negligible amount of network traffic
- Very high amount of disk I/O writes (> 450w/s)
What’s causing disk I/O?
So, something is using my disk. But what? The solution is to use the
sudo iotop -C 5 12
A common entry here is the
mds procoess, which has an insane amount of
BYTES. So, this
mds process is causing a lot of I/O, causing things to get slow.
mds process do?
A quick Google search reveals that the
mds process is actually the Spotlight indexer service.
I don’t use Spotlight at all, so let’s disable it - preventing the disk I/O.
sudo mdutil -a -i off
That’s all. Spotlight indexing disabled. After a few seconds the disk I/O dropped from ± 450w/s to 0w/s. Vim starts ups again within a seconds. I’m happy.
If, for some obscure reason, you want to re-enable Spotlight, use the following command:
sudo mdutil -a -i on
Hey! I'm a software engineer building rock solid back-end systems using Ruby, Ruby on Rails and Golang. In my free time I like to repair audio equipment, play the piano and experiment with electronics.
I'd love to hear your questions and comments on this article! Mention me on twitter, shoot me an email or read more about me.