devroom.io/content/posts/2011-06-27-your-mac-slow-disable-spotlight-in-snow-leopard.md
2019-06-05 14:32:16 +02:00

48 lines
1.5 KiB
Markdown

+++
date = "2011-06-27"
title = "Your Mac slow? Disable Spotlight in Snow Leopard"
tags = ["MacOSX", "spotlight", "diskio"]
slug = "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 `iotop` utility:
``` shell
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.
### What's the `mds` process do?
A quick Google search reveals that the `mds` process is actually the Spotlight indexer service.
### Disable Spotlight
I don't use Spotlight at all, so let's disable it - preventing the disk I/O.
``` shell
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.
### Enabling Spotlight
If, for some obscure reason, you want to re-enable Spotlight, use the following command:
``` shell
sudo mdutil -a -i on
```