Eliminating Font Cache Problems

  • by Rainer Erich Scheichelbauer
  • Tutorial
  • – Modified on

If you want to test your font in a real-life situation, and you are thinking about Adobe apps, well, then you can use the Adobe Fonts folder, and avoid cache problems from the start. Congratulations: You do not need to read any further, you are done!

Testing in Non-Adobe Apps

But let us assume you decided to test your font in an application like TextEdit or Word. So, you install it in the system by either opening it in Apple’s Font Book app, or by using a third-party font manager, or by simply dragging the font file into ~/Library/Fonts/.

Well, you shouldn’t.

Why not? Because installing a font with the same name as a previously installed one can seriously mess up your font caches. Caches are collections of previously calculated data. They can speed up your computer because it does not have to reprocess the original information every time. Likewise, font caches allow your Mac to speed up the use of installed fonts because all the stuff your Mac had to calculate to make your font appear on the screen, has already been done.

But, of course, if the original font has changed, and the font cache does not know about it, then the data stored in it is outdated and most likely wrong. Typical symptoms include:

  • The font menu does not show your font anymore
  • Glyphs do not appear at all
  • Changes you made in the font do not appear on the screen
  • Glyphs appear garbled and messed up on screen
  • You type one letter, but a different one appears
  • Paragraphs do not reflow properly
  • Your font does not print, or prints wrong or garbled letters

Or any other font weirdness, really.

Cleaning Caches

If this happens to you, delete the font from Font Book or whatever third-party utility you use. Important: Don’t just deactivate it, REMOVE IT. Afterwards, open up your Terminal.app (you can find it in /Applications/Utilities/) and type the following commands. Each line must be finished by pressing the Return key. The first line will prompt you for your password:

sudo atsutil databases -remove
atsutil server -shutdown
atsutil server -ping

And now, restart your Mac. No, really, open the Apple menu in the top left corner and choose Restart. Don’t think you can get away without a restart, otherwise the trouble will reappear. And you really do not want that, do you? OK, restart your Mac.

Cleaning Caches with an AppleScript

Since you are on a Mac, you can put these exact commands in an AppleScript, and make it conveniently available in the Script menu. Thus, you do not need to remember the Terminal voodoo or go looking for this blogpost again.

OK, let’s do this. In Finder, Choose Go > Utilities (Cmd-Shift-U) and double click the app called Script Editor:

Make a new script with File > New (Cmd-N), and copy and paste this into the new window:

    do shell script "sudo atsutil databases -remove" with administrator privileges
on error errMsg number errNum
    display dialog "Font cache error " & errNum & ": " & errMsg
end try
do shell script "atsutil server -shutdown"
do shell script "atsutil server -ping"
set buttonAnswer to text of button returned of (display dialog "It is strongly recommended that you restart your Mac, or at least log out and back in again." with title "Font caches cleaned" with icon caution buttons {"Restart", "Log out", "Later"} default button 3)
if buttonAnswer is "Log out" then
    tell application "System Events" to log out
else if buttonAnswer is "Restart" then
    tell application "System Events" to restart
end if

Click on the button with the hammer icon (Compile the Script) to verify the code. The code should now be syntax-coloured:

Save the script in your User Scripts folder. To do that, choose File > Move To…, and in the dialog that follows, press Cmd-Shift-G to bring up the Go to the Folder dialog. Here, you copy and paste this line:


When you do that, it will probably look something like this:

Press Go, and the Move To dialog shows the User Scripts folder, which is where we want to move our script. So you can safely press Move now.

Don’t forget to rename it to something that makes sense. Choose File > Rename… and call it Clean Font Caches.scpt or something like that. When you are done with that, turn on your Script menu, so you can easily access your AppleScript whenever you need it. To do that, access the preferences via Script Editor > Preferences (Cmd-comma), go to the General tab of the Preferences window, and make sure the checkbox next to Show Script menu in menu bar is on:

In the top right corner of your screen, your Mac displays a range of menu bar items. One of them is the Script menu. It allows you to run AppleScripts saved in special folders, one of them being ~/Library/Scripts/. So, when you click on it, you should see the AppleScript we just saved there:

Now you can:

  1. remove the font from your system,
  2. run the script (via the Script menu) to clean your font caches,
  3. restart your Mac (the script gives you an option to do that right away),
  4. and install the new version of your font.

Avoiding Cache Problems

There are a few simple ways to actually avoid the cache problems in the first place. Firstly, as mentioned at the beginning, test your fonts in Adobe apps. They have a special Fonts folder, fonts saved into these folders are active in Adobe apps right away, and, most importantly, they are not cached.

Secondly, if you really have to test your font in the system, then change the Family Name every time you install the font. You can extend the name by a number or a letter. Since the font caches are linked to the font name, a new installation of the font with a different name will not conflict with a previous installation. Only downside: after a few iterations, you will clutter your font menu to a point where it becomes difficult to handle.

Thirdly, and probably best of all, use the little TextPreview tool we created for just that purpose. It can watch a folder for new fonts added to it, and make them available in the app without installing them. Find the app on our Tools page.

Update 2013-07-04: Clarified where to delete the font.
Update 2014-06-16: Removed the superfluous user-specific cache-cleaning, the sudo line removes all caches.
Update 2016-01-02: Added link to Adobe Fonts Folder tutorial.
Update 2016-02-19: Updated screenshots for Glyphs 2.
Update 2017-06-04: Partial rewrite for better clarity, new screenshots, added TextPreview.