Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is there a script to clear font cache at shutdown or boot?

I've been having a problem with question mark symbols substituting for text in emails and Quick Look. I've been through all of the troubleshooting steps recommended to solve this problem. It persists.


I use Font Explorer X Pro which has cache cleaning tools built in. If I clean the system font cache and restart, the issue is resolved, but only until the next boot up.


1) Is there a solution that would correct this problem?

2) Or, is there a script to automatically clean the cache at shutdown or on boot so I don't have to try to remember to do it before shutting down?


Any insights are most welcome! Thanks.

iMac 21.5", macOS 10.14

Posted on Jul 3, 2019 6:40 AM

Reply
Question marked as Best reply

Posted on Jul 11, 2019 9:11 AM

Okay. I haven't tallied them up in quite a while, so I'll assume 2 and 3 are only the fonts installed by the OS. No third party fonts added to the Library or System folders.


But yes, third party fonts are any you've installed that are not included with the OS. Somewhere in that group of 1454 active fonts are ones that are conflicting with other fonts, or are damaged. Clearing the cache temporarily solves the issue. Any bad fonts that are active then once again damage the cache and you're right back where you were.


You can start by replacing your library with known good, fresh copies. If after that the issue continues, then you need to try and weed out the bad ones.


It's not fun. You activate about 20 at a time and see what happens. If good, activate another 20. If things go bad, at least one font of the last group activated is bad. Turn those off and activate smaller groups of that 20 until you've narrowed it down to the culprit(s). Delete the ones causing the problem.


As you can guess, this can take at least hours, if not days to sort through 3000 fonts.

Similar questions

12 replies
Question marked as Best reply

Jul 11, 2019 9:11 AM in response to Leah Mccloskey

Okay. I haven't tallied them up in quite a while, so I'll assume 2 and 3 are only the fonts installed by the OS. No third party fonts added to the Library or System folders.


But yes, third party fonts are any you've installed that are not included with the OS. Somewhere in that group of 1454 active fonts are ones that are conflicting with other fonts, or are damaged. Clearing the cache temporarily solves the issue. Any bad fonts that are active then once again damage the cache and you're right back where you were.


You can start by replacing your library with known good, fresh copies. If after that the issue continues, then you need to try and weed out the bad ones.


It's not fun. You activate about 20 at a time and see what happens. If good, activate another 20. If things go bad, at least one font of the last group activated is bad. Turn those off and activate smaller groups of that 20 until you've narrowed it down to the culprit(s). Delete the ones causing the problem.


As you can guess, this can take at least hours, if not days to sort through 3000 fonts.

Jul 3, 2019 7:45 AM in response to Leah Mccloskey

Are you using the most recent Font Explorer X Pro recommended for Mojave?


Seems to me that it would be a common denominator for recurring font cache issues, or deactivated fonts that are required by the operating system. Booting into Safe Boot mode also rebuilds the System font cache. Those question marks appearing in emails and Quick Look could be expected Mac fonts that you have deactivated, and the font replacement is breaking.


There are no scripts to clear font cache, but there are Terminal commands for that purpose.


Here is a living document about macOS fonts by Kurt Lang, and in particular, review the section on How to handle font caches. It talks about Font Explorer X.

Jul 4, 2019 12:42 PM in response to VikingOSX

Yes, I have the latest version of Font Explorer.


I have relatively recently booted in Safe Boot mode to troubleshoot a kernel panic issue. I finally had to reinstall the OS which seems to have solved the panic issue, but not the font problem.


I have run every font diagnostic tool I can find, removing and deleting where indicated. The issue persists.


If I clear the system font cache, regardless of the method, everything is fine until the next shut-down and reboot. I can't get it to "stick."


Thanks for the referral to the article which is very thorough and VERY long, and way more than I care to know about this. That said, I did scan it and stopped where I found some relevance. I checked my list of active system fonts against the required list...all good. I didn't see anything else that would help me fix this.


I shouldn't have to clean the system font cache and restart every day. I'm no techy, but I know that's not normal.

Jul 5, 2019 7:47 AM in response to Leah Mccloskey

Hello Leah,

very thorough and VERY long, and way more than I care to know about this.

Aw, but fonts are fun! 😁


The basic problem is you likely have at least one conflicting font somewhere. The OS then gets confused which is the correct font, and the font cache data gets mangled because the OS is trying to save a cache for duplicate fonts. The OS doesn't know what to do, so you then get the boxed question mark from the font, LastResort. You clear the cache, it's fixed momentarily, but the cache gets corrupted once again with conflicting data.


You may not see any fonts with the same Finder name, but it's the internal names of each font that matter. Those are the ones you see in your font lists. You could rename Palatino.ttc to xxx.ttc, and it would still show up in your apps and the OS as Palatino.


Things to do, preferably in the order listed:


a) If Font Book is still on the drive, remove it. Never have more than one font manager on your system at a time. They will fight for control of your fonts. This isn't all that easy to do in Mojave. That is, you can't just move Font Book to the trash since the OS insists it's required by the OS. It isn't. It's just another font manager. The OS will work perfectly fine without it.


How to remove it? Easiest is to startup to any other drive or partition you have the OS on. Once booted to that drive, you can delete anything you want from any other drive. System Integrity Protection only protects the startup disk.


If you can't do that, the next option takes more time, but isn't all that difficult. Restart and hold down the Command+R keys to boot into Recovery Mode. Once at the work screen, go to the top menu bar and choose Utilities > Terminal. In the Terminal window, type …


csrutil disable


… and press return. You should get a message that SIP has been successfully disabled. Then type …


reboot


… and press return. The Mac will restart.


Now, even from the startup drive, you can put Font Book in the trash and delete it using only your admin password. Make sure to empty the trash. Then repeat the steps above for Recovery Mode, except the first command will be …


crsutil enable


You should get a message that SIP has been successfully enabled.


Type reboot and press return. The moment the Mac goes into the restart sequence, hold down the Shift key to enter Safe Mode. This is just to once more delete all user cache files for the account you login to in Safe Mode. Once at the desktop, restart again normally.


Two more things to do related to Font Book before you're done with this first step. Now that Font Book is gone, you want to clear the last of anything related to its startup data.


From the desktop, hold the Option key down and from the top menu bar, choose Go > Library. This opens the Library folder in your user account. From there, open the Preferences folder. Delete these two items (both may not exist):


com.apple.FontBook.plist

com.apple.FontRegistry.user.plist


Lastly, remove all font cache data from the system.


Close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:


sudo atsutil databases -remove


This removes all font cache files. Both for the system and the current logged in user. After running the command, close Terminal and immediately restart your Mac.


All of this is to get Font Book and its related data off the drive so it stops interfering with FEX. This itself may not fix the visible issue of question marks where text should be, but we're just getting Font Book out of the way. Simply launching Font Book will cause it to recreate the .plist files you removed, and other hidden data. The OS then reads those to determine what fonts Font Book says should be active or not, which may not be what FEX says. This conflict of font management needs to be eliminated.


b) Now test to see if the issue returns. If it does, you have either damaged or conflicted third party fonts installed. Let us know and we'll address it as necessary.

I'm no techy, but I know that's not normal.

It's very normal. There are far more users who are very competent at using a computer, but not really knowing how to fix one than there are tech-heads.

Jul 5, 2019 8:26 AM in response to Kurt Lang

WOW, thanks, Kurt! This is going to take a chunk of time that I will need to set aside when work doesn't have me tied up, but I understand it all and will follow your instructions. Intuitively, I can see how Font Book might be causing as issue with FEX. We'll see.


I've been working on a Mac a loooong time, and I know enough to be dangerous. :-) Having to being my own tech for the last 30+ years, I've had to push into the technical side of things, consistently expanding my comfort zone (which is predominantly the creative, artistic end of the spectrum). The systems have gotten so much more complex, especially with all of the security layers, that it's gotten harder for me to troubleshoot. I am eternally grateful for the online communities that keep me sane.

Jul 11, 2019 8:25 AM in response to Leah Mccloskey

That means, somewhere, you have a conflicting or corrupt font. Or, multiples of them.


If you used Font Book at any time to add fonts to the system, they would go into the Fonts folder of your user account by default. In FEX, you can disable all of these at once by clicking on the expansion arrow next to System Fonts and and clearing the check box by your user name.


Disable any other third party fonts you've added.


Assuming you have added no fonts to the root /Library/Fonts/ folder, or the System's Fonts folder (nothing installed by the user should ever go there), then all that should be left open are the fonts installed by the OS.


After disabling all fonts installed by yourself, clear all font caches once more and test. If the issue returns, then the OS installed fonts are damaged. There is a way to install fresh copies of these without having to reinstall the entire OS.

Jul 11, 2019 8:47 AM in response to Kurt Lang

I've never used Font Book. I have always worked with a font manager (first Suitcase, then FE).


There are 3 folders in FEX under System:

1) my name (0 fonts)

2) All Users (332 fonts)

3) System (305 fonts)


Should I deactivate #2?


I have a personal library of over 3000 fonts. 1454 of them are activated. Are these are the "third party fonts" I should deactivate?


One last thing: if I clear the font caches as things are without deactivating any fonts, the problem will go away. The conundrum is that it doesn't stick. Since the issue returns on the next restart, I guess I need to restart twice to check it. Does that sound right to you?


Jul 14, 2019 10:29 AM in response to Kurt Lang

Thank you so much for your guidance, Kurt. I deactivated all but the essential system fonts and of course, the problem disappeared. The culprit is lurking somewhere in those 1400+ fonts I previously had open.


It's not surprising. I've been working on a Mac since the days of the original Macintosh box. Some of my fonts have traveled from machine to machine for a good twenty years, so they are bound to be corrupt or incompatible by now.


What I'm doing in order not to go through the time-sucking process of testing is to allow the programs and files to call for the fonts they need and check to see if the problem resurfaces. I will also check as I activate fonts when designing a new project. In the meantime, I'm happy to be rid of the question marks!

Jul 14, 2019 10:35 AM in response to Leah Mccloskey

That's a good plan! Wait until the issue surfaces on its own with only third party project fonts open. You instantly know those are the only ones you need to check, for the moment anyway.


There is another way. You used Suitcase at one time. That automatically gets you a serial number for Font Doctor. FEX has a great built-in function for checking fonts, but Font Doctor sometimes catches errors the other doesn't. Run your entire catalogue of fonts through it and see what it finds. The only thing to lose is a few minutes of time.

Is there a script to clear font cache at shutdown or boot?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.