Insider tip: 5 minutes to a faster Mac

Greetings,

So, recently, I have realized that the Spotlight (file searching and indexing system) on my Mac running OS X 10.7 (Lion) is totally killing my Mac Mini’s performance when I’m doing high-demand tasks like compiling MacPorts packages in a Terminal session.  I have a sneaking suspicion, though I have not verified, that this is due to some fairly severe Spotlight bugs that still remain in Lion.  Desperate to try and reclaim what I estimate to be the 60%-70% loss of system performance caused by Spotlight’s indexing facilities constantly hounding any disk activity it sees and constantly grinding away at my hard disk, I did some online research, and found some fairly simple steps you can take if you’re like me and you want to see a 50% or more gain in system performance.  That being said, these steps won’t be for everybody, especially since they keep Spotlight from updating your file search results.  Again, if you regularly rely on the upper-right-hand or Finder window search features, these steps are NOT for you, and sadly, you will just have to wait and see if Apple fixes Spotlight indexing bugs in future Lion updates.

DISCLAIMER — VERY IMPORTANT WARNING — READ OR LOSE DATA: Well, not exactly, but you could lose data if you aren’t careful with the way you follow these instructions.  If you do not have experience in working with the Mac terminal or Linux/BSD shells, you really should just forget about doing this, you could quite easily do more harm than good, including possibly even losing data, or putting yourself in a position where you could lose several hours of productivity having to restore a Time Machine backup to get your machine working again.

BEFORE YOU DO THIS: If you have Time Machine set up, or if you have a drive or drive space you can use to set it up, you really should take a full backup before doing this.  While I write these instructions as carefully as I can, nobody is perfect and you could make a mistake here even if you know exactly what you’re doing, do us both a favor and ensure you have a full backup on-hand from right before you try this so that you can restore to a working system if something breaks or you happen to break something.

ONE LAST (LITTLE) THING: These steps are designed for Lion, so, you’re on your own doing this for any other OS X release, in fact, you probably have no need to do this on any other OS X release.  Other OS X releases don’t seem to have these performance-killing bugs with Spotlight, or at least, they’re nowhere near this severe.

  1. Make sure you are logged into an OS X account that has Administrator privileges, that your account has a password set, and that you know your account’s password.  If you’re the only user of your computer, you should already be good as far as this goes, otherwise a bit of searching online may prove helpful.
  2. Open the Applications folder by clicking Finder in the Dock and pressing Shift+Command+A or if that doesn’t work, look in the “Applications” folder at the top of your Mac’s hard drive.  Under the Applications folder you’ll find the “Utilities” folder, and under the “Utilities” folder you’ll find “Terminal.app” (it might also just be called “Terminal” depending on your Finder settings).
  3. Copy and paste the following command into the terminal, then press Enter:
    sudo nano -w /etc/hostconfig
    Enter your password followed by pressing Enter if you’re asked for it.  If this doesn’t work, you either have the wrong password, or you don’t have Administrator privileges.
  4. Use the down arrow key to get the cursor to the end of the text of this file.  The cursor should hopefully be on a line by itself when it can’t go any further, but if it’s not, hold down the right arrow until the cursor stops, then if you had to do the right cursor hold, press Enter to create a new line.  In some strange cases, if you had a large file here, you might see some text scroll past the top of the screen, that is fine, just keep on working through these instructions.  Now, add this line to the bottom of the file by copying and pasting it:
    SPOTLIGHT=-NO-
    Press the Enter key once when you’re done with that.
  5. Press Control-O (O as in “Oh” NOT as in zero), press Enter, then press Control+X.  This saves and closes the file we need to edit.
  6. We’re almost done already!  Now, we need to move the file that causes Spotlight to start at boot-up into a safe place.  Copy and paste this into the Terminal:
    sudo mkdir -p /System/Library/LaunchDaemonsDISABLED/
    sudo mv /System/Library/LaunchDaemons/com.apple.metadata.mds.plist /System/Library/LaunchDaemonsDISABLED/

    Press the Enter key once after the second line.
  7. You can quit out of Terminal now.  Press Command+Q if you want to do that.
  8. Reboot your machine, it should come back to life properly, and if so you should now be Spotlight-free.
HOW TO REVERSE THIS: The next time Apple updates Lion, if you want to see if Spotlight might be fixed, it’s fairly easy to move things back into place.  Follow these steps:
  1. Open the Terminal again.
  2. Again, run this command, copy and paste it:
    sudo nano -w /etc/hostconfig
    Press Enter to run it. Enter your password followed by pressing Enter if you’re asked for it.
  3. Use the cursor keys to put the cursor over (blocking/covering) the “S” in this line:
    SPOTLIGHT=-NO-
  4. Press Control+K to delete that line.
  5. Press Control-O (O as in “Oh” NOT as in zero), press Enter, then press Control+X.  This saves and closes the file we need to edit.
  6. Run (copy and paste) this command to move the start-up file for Spotlight back into place:
    sudo mv /System/Library/LaunchDaemonsDISABLED/com.apple.metadata.mds.plist /System/Library/LaunchDaemons/
    Press Enter to run the command.
  7. You can quit out of Terminal now.  Press Command+Q if you want to do that.
  8. Reboot your machine, it should come back to life properly, and if so you should have Spotlight back.

REFERENCE: OS X Daily, “How to completely disable Spotlight”
http://osxdaily.com/2007/03/22/how-to-completely-disable-spotlight/

Here’s to your happier, faster Lion powered Mac!
–Quinn

Leave a Reply

You must be logged in to post a comment.