On macOS 10.12.6 SIP was disabled (to issue an NVRAM command).
Unrelated to that command, but very possibly related to disabled SIP: After a reboot the Spotlight icon is gone, the PreferencePane errors with "Could not load Spotlight preference pane" and the Spotlight process crashes constantly.

Launchd reports com.apple.spotlight as status 6971 (the numbers vary) at first and then SIGABRT; and the crash reporter lists:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY 

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString count]: unrecognized selector sent to instance 0x7fffa84e4d40'
terminating with uncaught exception of type NSException
abort() called

I then tried disabling Spotlight with

 sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

That executed without an error message.

The command

sudo mdutil -a -i off

also ran without error before disabling Spotlight. Now the error message for that command is:

Spotlight server is disabled.

The ActivityMonitor now only lists SpotlightAggregator as still running, no "Spotlight" no "md*" process appears.

EtreCheck highlights this info:

 System Software:    
  macOS Sierra 10.12.6 (16G1408)     
  System Load: 2.43 (1 min ago) 2.25 (5 min ago) 1.83 (15 min ago)    
    Diagnostics Information (past 7 days):
  Spotlight.app Crash
      *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString count]: unrecognized selector sent to instance 0x7fffa90ced40'
terminating with uncaught exception of type NSException
abort() called

The Activity Monitor offering "Spotlight Diagnostics" produces a lot of data, but does not reveal anything apparent.

sudo launchctl list | grep -i md
-   0   com.apple.metadata.mds.scan
-   0   com.apple.mtmd
-   0   com.apple.mdmclient.daemon
228 0   com.apple.mDNSResponderHelper.reloaded
-   0   com.apple.metadata.mds.index
-   0   com.apple.msrpc.mdssvc
222 0   com.apple.mDNSResponder.reloaded
2428    0   com.apple.xpc.smd
80  0   com.apple.metadata.mds
-   0   com.apple.platform.ptmd
-   0   com.apple.metadata.mds.spindump
79  0   com.apple.warmd

The ReportCrash process now hovers on this machine between 40% and 100% CPU utilisation, as Spotlight crashes 6 times a minute..

It would be nice to get to the bottom of the cause of this but despite never using Spotlight a quick fix for the crashes would be nice to have.

How do I fix this error? At least how do I stop Spotlight from disabling the whole computer with its constant crash reports?

Update: Created an installation medium and re-installed with the latest Sierra installer over the old System. System is now downgraded to 10.12.6 (16G29).
Result: Spotlight still crashes.

After another clean install

Update2: After a clean install Spotlight worked as advertised. But the most stupid idea ever that is MigrationAssistant did migrate the error as well. I conclude that the error is not in the binaries that Apple ships out but within a configuration file that MigrationAssistant does not sanitise.

After another clean install of the system I have to observe Spotlight crashing along with AppleSpell, suggestd, CalendarAgant, and SafarBookamrksSyncAgent. On my migrated admin user. (Copied manually just that user's folder).
These symptoms do not appear with another admin user.

  • 1
    Have you tried to disable spotlight with mdutil ? This should trash the "stores" . Then attempt to have spotlight rebuild those stores. You might see increased CPU usage for mdworker for a while. – fd0 Jul 5 '18 at 14:12
  • 1
    @fd0 dis and re-enable both via launchctl and mdutil. No change – LangLangC Jul 5 '18 at 14:24
  • 2
    Oh wow - if you've already discovered mddiagnose from Activity Monitor and those logs aren't helping pinpoint a file that causes the crash or submitted that to engineering for support, we'll need to dig up how to start the spotlight processes in debug / verbose mode to see which file on the storage is causing the errors. – bmike Jul 14 '18 at 17:05
  • 1
    @bmike Maybe. Engineering: Without actual person at other end of mail, that has taken quite long lately… Currently I copy each folder as needed from the defective clone. So far so OK. Equally inefficient. – But the mystery is: why does Spotlight crash in the above scenario when indexing is off and the daemon un-launchctled? What's calling it up anyway? – LangLangC Jul 14 '18 at 18:48
  • 1
    I’m pretty sure it indexes parts of the system whether you try to exclude all tha areas you are expected to be able to exclude. Also, if the configuration files or database it reads at start is hosed, it will be crashtastic. – bmike Jul 14 '18 at 20:22

You must log in to answer this question.

Browse other questions tagged .