Archives

Creative Commons License
This blog is licensed under a Creative Commons License.

Run the Spotlight indexer at a lower priority

| 7 Comments | No TrackBacks

I realized the other day that on OS X, the Spotlight indexing process is started using launchd. This makes it very easy to modify the launchd configuration script to insure that background indexing uses the least amount of CPU and I/O bandwidth possible.

Edit the configuration script by running this command as root:

# open /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

You should find yourself in the Property List Editor application. Now add two keys at the top-level, one named LowPriorityIO, which is a boolean set to true, and another named Nice which should be an integer set to 20.

Now whenever the mds spawns mdworker processes to index recent changes to the file system, it won’t get in your way quite as much as before. (Without this change, mdworker processes run at the same priority as user processes, according to output from the ps axl command).

No TrackBacks

TrackBack URL: http://www.newartisans.com/mt/mt-tb.cgi/15

7 Comments

Nice tip. But how exactly do you suggest running this command as root? su open … ? sudo, then … ? The pretty Property List Editor would not let me save the file, so I dropped into vi (shudder). That worked.

You can put sudo in front of John’s command. To let you save from the Property List Editor just “sudo chmod o+w com.apple.metadata.mds.plist” beforehand. Don’t forget to give yourself write access on the directory, too, and remove the write access from both when you’re done. You’ll also need to change the file ownership back to root, as the save will make it yours.

sudo defaults write /System/Library/LaunchDaemons/com.apple.metadata.mds LowPriorityIO -bool true
sudo defaults write /System/Library/LaunchDaemons/com.apple.metadata.mds Nice -int 20
sudo plutil -convert xml1 /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
SB-iMac(~) % sudo defaults write /System/Library/LaunchDaemons/ com.apple.metadata.mds LowPriorityIO -bool true
Password:
2008-11-12 13:20:36.332 defaults[3149:c0b] Unexpected argument -bool; leaving defaults unchanged.
SB-iMac(~) % sudo defaults write /System/Library/LaunchDaemons/ com.apple.metadata.mds Nice -int 20
2008-11-12 13:20:50.663 defaults[3160:a0b] Unexpected argument -int; leaving defaults unchanged.
SB-iMac(~) %

any suggestions?

sudo su

and then

open /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

this worked for me

About this Entry

This page contains a single entry by John Wiegley published on April 8, 2008 8:25 PM.

Script of the week: linkdups was the previous entry in this blog.

Diving into Git is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Recent Comments

  • Curt Sampson: That there’s “no state” in Haskell is quite wrong; in read more
  • rv: Hi. I wanted to drop you a quick note to read more
  • John Wiegley: It’s here: http://ftp.newartisans.com/pub/python/modpython_gateway.py read more
  • Leon: The file “modpython_gateway.py” Is no longer available in the downloads read more
  • Kathy: Well, the article is really the sweetest on this laudable read more
  • mr.design: Hi John, I just started to read your GFTBU, it’s read more
  • yoman: “Barfin”? “Slurping”? “Slime” “Hunchentoot” ??? What in the T.F. world read more
  • John Wiegley: Something like this is slated for the next release of read more
  • womens health: According to me, Apple has implemented something called blocks, which read more
  • Bjorn Tipling: Why would you add instructions for installing an editor when read more
OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.261