Movatterモバイル変換


[0]ホーム

URL:


Daring Fireball

ByJohn Gruber

Sentry

Sentry — Catch, trace,
and fix bugs across your entire stack.

Login Delays and Damaged Font Caches on Mac OS X 10.3

Monday, 21 March 2005

At some point a few weeks ago, I noticed my iBook had developed aproblem: whenever I logged in, I’d get the SPOD1 cursor,spinning on an empty desktop, for about 90 seconds. Only after thatwould my login proceed: menu bar, Dock, Finder, login itemslaunching. Other than this delay at login, however, nothing elseseemed awry.

In fact, the first few times this happened I wasn’t sure if anythingat all was out of the ordinary. I often go many days without loggingout, and when I do, it’s typically because my virtual memory swapfiles have grown large enough that a log-out/log-in cycle seemscalled for. I thought perhaps the SPOD was being shown while thesystem cleaned up my old swap files, or performed some otherhousecleaning-type periodic task.

I realized something was definitely wrong, however, when Idetermined that this delay occurred every time I logged in. A fewdays ago, I tried rebooting, logging in, and then immediatelylogging out and back in again. Even then, I had to suffer throughthe delay.

Something, obviously, was wrong. But what?

It wasn’t an errant login item (a.k.a. the “startup items” specifiedin the Accounts panel in System Preferences) — the delay occurredeven if I suppressed them by logging in while holding down the Shiftkey.

Googling for “slow login mac os x”, “login delay mac os x”, “loginspod mac os x”, and so forth turned up nothing that seemedapplicable.

A corrupt preference file, perhaps? I made an archive of my regularPreferences folder (in the Library folder in my user’s homeaccount), threw out my old Preferences folder, then logged out andback in, letting the system create a factory-fresh set ofpreferences. No help — the login delay was still there.

Enough guessing. I went to another machine, and connected to myiBook via ssh using Terminal. Logging in remotely via ssh is enabledusing the Remote Access checkbox in the Sharing panel in SystemPreferences. In Terminal, from another Mac on your local network,type:

ssh[email protected]

(For me, this wasssh[email protected].)

Now I could usetop, a command-line program analogous to ActivityMonitor. It lists all the processes running on the machine, andprovides information such as how much memory and processor timethey’re using.

I went back to my iBook, logged out, and logged back in. The SPODappeared, and I went back to the other Mac (the one where I wasconnected via ssh to my iBook) to see what top showed. Something wasgoing on while the SPOD was spinning, and I wanted to know what. Underordinary use, it’s convenient and natural to think of Mac OS X as“the system”. But on the inside, in terms of how things really work,there’s no such thing. As a Unix-y operating system, the Mac OS X“system” is really a bunch of small processes that work together,each of them doing their own little thing. So what I was looking forin top was a process using a lot of CPU while my iBook was doing itsSPOD-for-90-seconds-on-login thing.

And, bingo: ATSServer was getting most of the CPU cycles thatweren’t being consumed by top itself.

Luckily, I knew what the “ATS” in “ATSServer” stands for:AppleType Services. According to thischart of Mac OS X’s systemservers and daemons, ATSServer is the “Apple Type Solutionserver, enabling system-wide font management.”2

So some sort of font problem was the root cause. I hadn’t added anynew fonts recently, so my guess was that it wasn’t one or moredamaged fonts, but rather damaged font caches. A bit of Googlingturned upthis PDF document from Apple, “Advanced TypographyWith Mac OS X”, which Google conveniently offered todisplay asHTML. From this document:

Deleting font caches

If your fonts are garbled, or if there are fonts that won’t emptyfrom the Trash even after you restart your Mac, try deleting theMac OS X font caches.

You can do this manually by finding and removing these files:

  • In /System/Library/Caches:
    • fontTablesAnnex
      (fontTablesAnnex contains the character encodings/mappings forall of the fonts on your system. Information in this file canlead to garbled text.)
    • com.apple.ATS.System.fcache
    • com.apple.ATSServer.FODB_System
  • In /Library/Caches:
    • com.apple.ATS
  • In your home directory’s Library/Preferences folder:
    • com.apple.ATS.plist

In my case, the problem was solved by trashing/System/Library/Caches/fontTablesAnnex. None of these cache filesare essential, however, so I deleted them all. (The“com.apple.ATS.plist” prefs file, on the other hand, tracks, amongother things, the disabled fonts you’ve specified using Font Book.I left this in place.)

I restarted — not just logged out, but restarted — immediatelyafter trashing these files. Logging in to my account now took only afew seconds.3

However, I remain unconvinced that this has actually solved theproblem. My problematic “fontTablesAnnex” file was over 64 MB; uponrestarting and logging in, my newly-rebuilt “fontTablesAnnex” filewas only 1 MB. However, each time I logged in, it seemed to grow byanother 400 KB, and at other times it seemed to grow significantlywhile I’m logged in.

Within two days, it had grown to 32 MB — although admittedly,during that time I’d been logging out and in repeatedly, as wellas poking about my fonts — and logging in to my account againbecame slow. I deleted “fontTablesAnnex” a second time, and normallog-in performance has been restored (again). If anyone has anysuggestions as to what may be causing this, let me know.

Interesting Question

This strikes me as a troubleshooting session that most Mac usersnever could have managed. Most have never even heard of top or ssh,let alone would have known how to use them to see what was going onwhile the SPOD was displayed. But trickier still is this: what couldI have done if I didn’t have a second computer from which to sshinto my iBook?

Update:Kevin Ballard andEverett Howe (love that username)both wrote to point out that fast user switching allows you tomonitor your login with top without using a second computer.Everett writes:

Here’s a possible solution:  Create a second user account on youriBook. Enable fast user switching. Log out of your main account,and log in to the new account. Open a terminal, and run

top -l 120 -n 5 -o cpu

The “-l” will make top print its output to the terminal (insteadof its usual behavior of writing over the same part of the terminaleach time it updates). In particular, “-l 120” will make it printits output for 120 iterations before stopping; since the defaultdelay between sampling the processes is 1 second, this will give youtwo minutes of data. The “-o cpu” will make it sort output by CPUusage. The “-n 5” will limit the output to the top five processes.

While top is running, use fast user switching to log in to yourusual account. After your unusually long startup, switch backto the new account and see what the top output looks like.


  1. Spinning pizza of death.↩︎

  2. So, technically, I was wrong about what the “S” in “ATS” stood for, but I was right that it was a system component pertaining to fonts.↩︎

  3. Those of you who religiously delete font caches everytime you install a system or security update, feel free to smirk smugly.↩︎

Previous:On the Discovery Ruling in ‘Apple v. Does’
Next:Font Caches Gone Wild

Display Preferences

Copyright © 2002–2026 The Daring Fireball Company LLC.


[8]ページ先頭

©2009-2026 Movatter.jp