Search
Enter Keywords:
Home
OS X Font Cache Cleaning Script PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Michael Salsbury   
Friday, 03 June 2005

As part of its normal operation, Mac OS X creates "font cache" files that help it to speed up the display of fonts on the screen.  Unfortunately, as with many types of cache files, OS X font cache files can become corrupted or damaged.  When this happens, strange font display problems, application crashes, or system crashes may occur.  It's a good idea to periodically delete the font cache files, which OS X will dutifully rebuild on the next reboot with clean non-corrupted copies.

Font cache files are stored in "/System/Library/Caches" in a variety of files with different names.  Those names all follow specific patterns, so we can easily build a script to look for files with those names and delete them automatically.

This script has been tested and to the best of my knowledge appears to work on OS X 10.3.x and 10.4.  It may or may not work with earlier or later versions of OS X.  As with all my scripts, I provide it "as is" without warranty or support of any kind.  If you choose to try this script, you accept all responsibility for any damage it does to your computer or data.

This script can be executed from the command line or a cron task.

#!/bin/csh
#
# This script removes the Font Cache files from the system. These
# files can become corrupted and cause garbled printouts.
#
# Because these are files used in the system, we force a reboot
# when we're done to ensure continued system stability.
#
# Updated: October 5, 2004
# By: Mike Salsbury
#
#
echo " "
echo "This script will clean the font caches on the machine."
echo " "
echo "When it is finished executing, the Mac should be rebooted or"
echo "it could become unstable."
echo " "
echo "Enter the admin/root password when/if prompted."
echo " "
sudo rm -f /System/Library/Caches/com.apple.ATS.System*.fcache
sudo rm -f /System/Library/Caches/com.apple.ATSServer.FODB_*System
sudo rm -f /System/Library/Caches/fontTablesAnnex*
sudo rm -rf /Library/Caches/com.apple.ATS/ >>
# Shutdown the computer and restart automatically afterward.
sudo shutdown -r now
echo " "
echo "Finished cleaning font caches. Please reboot the Mac now if it doesn't automatically do so."