How do Run the Spotlight indexer at a lower priority to reduce CPU load on your Mac
- Do NOT follow this procedure until approved!
- Do NOT attempt this procedure on OS-10.9 (Mavericks)! The mds daemon functions differently and cannot have its processing priority lowered. Attempting this procedure will only cause your computer to malfunction.
OS-X has a built-in file content indexing system called Spotlight. This system relies upon a system daemon named mds. That daemon spawns in turn UNIX processes that run invisibly in the background to index files during the time your Macintosh is running. The mds daemon is supposed to accomplish this task in such a way as to not interfere with the operations of your computer. However, there are situations that can fool the mds daemon into assuming that indexing can be accomplished when it isn't the most convenient. For example, even if a computer is not being used, it may be in a bedroom and the CPU intensive task of indexing files could turn on the computers fans - potentially becoming a nuisance. Many users of WeatherCat run their computers 24/7, as a result, the evening and early morning hours provide ample time to accomplish the task of indexing a hard drive. In that case, it may be desirable to have the mds daemon work as slowly as it can be configured to.
Early in the existence of UNIX, a system to control the priority of running applications was added. This system under the UNIX command name: nice allows for CPU intensive applications to be given lower priority than applications requiring quick response. OS-X continues to incorporate this feature and various users have found a way to "renice" the mds daemon to reduce its effect on your computer. Two possible ways to do this are described in these blog entries:
- Run the Spotlight indexer at a lower priority
- Is mdworker Jeopardizing Your Resources? Run It at a Lower Priority
The procedure below is a conservative composite of the two blog entries above. While there is nothing extremely dangerous in following this procedure, it is modifying your system. Therefore extra caution is advised. System backups are always recommended beyond the backup proposed in this procedure.
What is required is to modify a file in your system called: com.apple.metadata.mds.plist. The complete UNIX path to this file is:
One way to modify this file is to use a free property list editor called Pref Setter. If you have Apple's development environment installed than you can use the Xcode: Property List Editor. Either tool will work for this procedure.
To start, you should make two copies of the com.apple.metadata.mds.plist file - one to modify and one as a backup in case you run into a problem. To do this, you will need to use the Terminal application. Enter the following 3 commands one after the other:
cd cp /System/Library/LaunchDaemons/com.apple.metadata.mds.plist ~ cp /System/Library/LaunchDaemons/com.apple.metadata.mds.plist ~/Desktop
The last command will put a copy of the com.apple.metadata.mds.plist file on your desktop so you may move it to any safe place as your backup version.
Now launch either Pref Setter or Property List Editor and open the copy of the com.apple.metadata.mds.plist in your home folder. It will look something like this:
You will now need to add two keys. To do this use the gear menu at the top of Pref Setter application. The first new key you need to create has the name: LowPriorityIO. Keys are like computer language variable types. They hold a type of data and then are set to a particular value. The key LowPriorityIO is a boolean type key and it should have the value of true. The second key you need to create has the name Nice and is of type integer. You need to set this key to the value 20. When you are completed you should have something that looks like this in Pref Setter:
Here is the same modified com.apple.metadata.mds.plist file as it appears in Apple's Property List Editor:
Once you are satisfied that you have correctly made these modifications, save the modified file.
Now as a precaution, run the following command in your terminal session:
This will open a TextEdit window that should look something like this:
The order of the elements may vary, but the each part should be as they are shown.
Once you are satisfied that you have a correctly modified file, you can install the file and restart your Macinotsh. Installing the modified file can be done with this terminal command:
sudo mv ~/com.apple.metadata.mds.plist /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
You will be asked to supply your Mac administrator's password. Once this is done you can restart your Mac and you should see that the mds process uses less of your computer's resources. Should you have any problems, copy the backup copy of the com.apple.metadata.mds.plist that you had kept to your home folder and once more use the terminal command above to move that version into the correct location. Once again, by rebooting you will return to the condition you were before making any modifications.
As noted this procedure requires meticulous precision. However, if you follow this procedure to the letter, you shouldn't have any difficulties with this modification.