or how nuking my font caches fixed “secondary (right) click”

Here’s a short tale that left me flabbergasted earlier this week. Let’s first introduce the main characters before embarking on this strange trip.

First, the main character, an iMac, model “late 2013” running OS X 10.9.4, which has been loyally providing it’s services for about 10 months, without a single complaint. Next is the “Magic Mouse”, this device has been tied to it’s wireless Bluetooth leash ever since it came along the iMac.

The “secondary click” a.k.a. “right click” had been enabled since I setup this machine, however it suddently decided to silently fail doing it’s thing. It’s inconvenient and I hoped/assumed a reboot would set it straight.

No such luck.

Perhaps the mouse itself is broken for whatever reason; so I paired it with my MacBook Air and it worked just fine. Of course it did.

According to various posts on the Apple discussion forums there are several possible solutions to the “right click not working”-problem:

  • Reset PRAM
  • Remove /System/Library/Extensions/AppleHIDMouse.kext and reboot
  • Replace aforementioned file with a known good copy from TimeMachine or a different Mac with the same OS X version

Since having to press the ctrl key for every time I want the secondary click wasn’t something I could get used to, and the fact it worked and then (seemingly overnight) it didn’t, I decided to give the geniuses at Apple a call.

“Genius”

So yes, I’ve enabled the “secondary click” in “System Preferences”, and no I’m not holding the mouse upside down, and yes it works on my MacBook. How many Bluetooth devices do I have around here? Just two, my Apple wireless keyboard and the mouse refusing to do the right click.

According to the “genius” (sarcasm intended) I was talking to, it could be electromagnetic interference. Well, the fact that nothing changed in the surroundings, the mouse is give or take 40 cm away from the iMac and it worked at the same desk with my MacBook made no difference. But in order to continue diagnosing the interference theory had to be rules out…by moving the iMac to a different floor and try it there. Gee wiz, still no secondary click.

After some further failed attempts and 30 minutes of being treated like someone who had just managed to figure out how to operate a computer it was suggested to re-wait for it-install. Reinstall!

At this point I concluded the call and decided I wouldn’t want to be submitted to Windowsesque situation. Reinstallation surely couldn’t be the solution for this problem. That’d be like….well, reinstalling your OS to fix a non-working right click of your mouse.

Enter the TimeMachine

That’s when I noticed TimeMachine hadn’t completed a backup since two days, it was stuck at “Preparing Backup…”. A quick look at the Activity Monitor and logs revealed an interesting situation:

12/09/14 15:49:24,960 fontworker[722]: could not consume extension for /Library/Application Support/Apple/Fonts/iWork/TwentiethCentury.ttc (f140f40f97bbaf544259bfa4f6290c7860cfc8a7;00000000;00000000;0000000000000020;com.apple.app-sandbox.read-write;00000001;01000008;0000000001d72b7e;/library/application support/apple/fonts/iwork/twentiethcentury.ttc) -- (12:Cannot allocate memory)
12/09/14 15:49:24,960 fontworker[722]: failed consuming extension 0 of 29

The fontworker and fontd processes were going apeshit, fighting for the grand price of > 100% CPU time.

Upon inspection of /Library/Application Support/Apple/ I realised there was no Apple/ directory here, actually, half of /Library/Application Support/ was just plain missing. I copied over the missing parts from my other OS X installation and rebooted; still the fontworker and fontd processes were going mental (and out of sheer curiosity I tried a secondary click and of course it still failed) Some further searching revealed that FontNuke could help. So I ran this tool to nuke the four caches it had found and rebooted.

This paragraph’s title is a good summary of my reaction on what I noticed next. fontworker and fontd were doing what they do without eating all CPU, as expected.

However, my secondary click worked too. Yes, nuking my font caches was the final step needed in order for my Bluetooth mouse’s right click to work again.

This cannot be related right? Something else has have magically autofixed itself, right…right?