How to clear font caches in Leopard

As you use various fonts in OS X, the system caches font data, to make future access faster. However, there’s also the possibility that those caches may get corrupted, which can cause all sorts of interesting problems. One common symptom of corrupted font caches is seeing strange and overlapping characters in whatever application happens to be accessing the font with a corrupted cache.

Prior to OS X 10.5, all font caches resided in the top-level Library -> Caches folder, in a file named com.apple.ATS. If you suspected a corrupted font cache, you just had to trash that file, then logout and login, and the problem would hopefully be gone. That all changed in 10.5, however, as font caches are now created for each user, and stored in a subfolder buried in the /var -> folders directory. Folder names in this hierarchy are coded, making it much tougher to find the com.apple.ATS file.

Thankfully, there’s a relatively easy way around this problem—the atsutil command-line program. atsutil lets you easily clear the font cache for one (or all) users on the system, and stop and restart the Apple Type Services server, which (should) do the same thing as logging out and logging in after deleting a cache file in pre-10.5 systems.

Please note that you do not need to do this regularly—in fact, I advise not using this hint unless you’re having a problem that you specifically suspect is related to a corrupted font cache. But if you do want to clear the font cache in 10.5, here’s how to do it yourself (note that there are third party programs, such as the $10 Font Finagler, designed to clear font caches).

To clear the current user’s font cache, first quit all running applications (otherwise, you may see font oddities after using the command), then open Terminal (in Applications -> Utilities) and run this command:

atsutil databases -removeUser

If you want to remove the font cache for all users, use this command, and provide your admin password when asked:

sudo atsutil databases -remove

Once you’ve cleared the caches, you should stop and restart the ATS server with these commands:

$ atsutil server -shutdown

$ atsutil server -ping

It will take a second or two for the server to restart, but when it does, you should be good to go. If anything still looks odd, a logout and login should take care of any lingering issues.

Subscribe to the MacWeek Newsletter

Comments