# Mac OS X spell checking problems

Mac OS X loads services from various locations. Knowing what they are could save you a lot of trouble. I was just about to reinstall again my freshly reinstalled MacBook because I didn’t know those locations.

An obscure OS X feature (or more likely a bug) stroke me a few hours ago. All of a sudden my Safari started throwing Couldn’t connect to Spell Check service alerts after every keystroke in any text field. I Goggled a lot, read tons of articles, deleted some files, repaired permissions with Disk Utility and rebooted several times but with no effect at all.

First I looked for my ~/Library/Services folder but I didn’t have one. Then looked in /System/Library/Services and found the service called AppleSpell.service. I checked the permissions of the executable file inside and they were OK. Running the executable by hand didn’t help – the message still popped up in Safari. Then I looked at Console’s output just to find the following messages inside:

Aug  3 23:39:04 home com.apple.launchd[102] ([0x0-0x14014].net.leuski.cocoAspell.Service[157]): Exited abnormally: Trace/BPT trap
Aug  3 23:45:49 home [0x0-0x1b01b].net.leuski.cocoAspell.Service[174]: dyld: Library not loaded: /usr/local/lib/libaspell.15.dylib
Aug  3 23:45:49 home [0x0-0x1b01b].net.leuski.cocoAspell.Service[174]:   Referenced from: /Volumes/Time Machine/Library/Services/cocoAspell.service/Contents/MacOS/cocoAspell
Aug  3 23:45:49 home [0x0-0x1b01b].net.leuski.cocoAspell.Service[174]:   Reason: image not found
Aug  3 23:45:49 home ReportCrash[175]: Formulating crash report for process cocoAspell[174]


It turned out that the sole reason for this misbehaviour was that Mac OS X was loading the cocoAspell.service from my external backup hard drive where I had put my home directory’s contents some hours ago and it was trying to dynlink to a library file that was wiped out after I reinstalled the OS earlier that day. Removing the cocaAspell.service bundle from the Library/Services folder on my backup drive and logging off and on again solved the problem.

Positional independence of the executable bundles is one of my favourite OS X features, but this time it has gone too far. Isn’t autoloading suspicious services from external devices a little bit counter security?