# fontspec font-not-found / Invalid fontname on Mac update

Over the past few years, I have had a rare but recurring problem where, when I typeset a document using EB Garamond, which I have installed on my Mac, I receive the following error:

(/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec.cfg)))kpathsea:make_tex: Invalid fontname EB Garamond', contains ' '
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "EB Garamond" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................


This occurs even with a bare-bones MWE, and it occurs with completely updated software. It seems to only affect fonts installed locally, that is, in /Users/moacir/Library/Fonts. An example of the system profiler description of two culprit fonts is at the bottom.

It does not occur when I call xelatex from TeXShop, even though TeXShop uses the exact same path to TeXLive. It also does not seem to occur with system fonts, by which I mean fonts installed in /System or /Library. For example, if I have sections in Helvetica Neue, they appear in the pdf. The sections in EB Garamond are blank.

It seems that restarting the Mac when the problem occurs solves it, but I would rather not have to restart my computer every time the problem occurs.

• XeLaTeX was working fine whenever I’d use it throughout early 2017. I kept up with MacOS updates, but did not install TeXLive 2017.
• In mid-July, I used XeLaTeX to typeset an article I’m writing in EB Garamond. This is the last time I know I used the software from the command line.
• In late July, I updated my computer to 10.12.6 (with restart).
• On August 1, I start working on a new project involving TeX, and the error appears. I do not remember if I had used XeLaTeX since upgrading to 10.12.6.
• On August 2, I publish the first version of this question.
• I then update TeXLive to 2017 (vaguely thinking that solved the problem the last time I had it), and the problem continues.
• I restart the computer and the problem goes away.
• On August 4, the problem reappears. A restart makes it go away.
• On August 5, the problem reappears. A restart makes it go away.

The four (including in 2016) times I had this problem, they were solved once “by magic” and three times by a restart. I wish I had a more useful solution, however, than either of these two.

Currently, the system is running fine.

MWE:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\begin{document}
All human beings are born free and equal in dignity and rights.
\end{document}


Here are the font descriptions on my system both of two fonts that give trouble (HumboldtFraktur and EB Garamond):

EBGaramond.otf:

Kind: OpenType
Valid: Yes
Enabled: Yes
Location: /Users/moacir/Library/Fonts/EBGaramond.otf
Typefaces:
EBGaramond:
Full Name: EB Garamond
Family: EB Garamond
Style: Regular
Version: Version 000.010
Unique Name: FontForge 2.0 : EB Garamond : 6-3-2011
Copyright: Created by Georg Duffner with FontForge 2.0 (http://fontforge.sf.net)
Outline: Yes
Valid: Yes
Enabled: Yes
Duplicate: No
Copy Protected: No
Embeddable: Yes

HumboldtFraktur-Regular.ttf:

Kind: TrueType
Valid: Yes
Enabled: Yes
Location: /Users/moacir/Library/Fonts/HumboldtFraktur-Regular.ttf
Typefaces:
HumboldtFraktur:
Full Name: HumboldtFraktur
Family: HumboldtFraktur
Style: Regular
Version: Version 1.0; 2002; initial release
Unique Name: TypographerMediengestaltung: HumboldtFraktur: 2002
Designer: Dieter Steffmann
Description: Humboldt-Fraktur geschaffen von Hiero Rhode, 1938. Digitalisiert und ergaenzt durch Dieter Steffmann, Kreuztal.
Outline: Yes
Valid: Yes
Enabled: Yes
Duplicate: No
Copy Protected: No
Embeddable: Yes

• Welcome! Shouldn't you be using current MacTeX with a Sierra system? (Not certain about this, but if OS changes need to be accommodated, a deprecated version isn't going to make those accommodations.) – cfr Aug 2 '17 at 3:12
• You might also try removing the temporary directory where this stuff gets cached. kpsewhich -var TEXMFVAR will give you the path. – cfr Aug 2 '17 at 3:14
• @cfr Thanks. Good point, and I meant to upgrade to 2017 before posting the question. I installed it, restarted, and now it works (it still didn't work before the restart, even though it was using the 2017 binaries). But it remains the case that it seemed to stop working on the upgrade from 10.12.5 to 10.12.6. But now the problem's disappeared… – Moacir Aug 2 '17 at 4:25
• I'm voting to close this question as off-topic because it is resolved by updating to latest versions of software. – Andrew Swann Aug 2 '17 at 7:40
• here's a timeline, ignoring what happened last year in the previous question I asked: xelatex works fine, I upgrade MacOS, error appears. I update to TL 17, error persists. I restart. Error goes away. Next day, error returns. Restart and it goes away. Next day, error returns. Restart and it goes away. In other words, this problem has happened twice now w/ all new software. – Moacir Aug 6 '17 at 2:57

Following the recommendation by @WillRobertson, it seems like the answer, for now, is to avoid using fontspec's font finding abilities and change the MWE to read:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{EBGaramond}[
Path = /Users/moacir/Library/Fonts/,
UprightFont = * ,
ItalicFont = *12-Italic ,
SmallCapsFont = *SC ,
Extension = .otf
]
\begin{document}
All human beings are born free and equal in dignity and rights.
\end{document}


Note that the settings for ItalicFont and SmallCapsFont are consistent with what EB Garamond offers.

Might not be relevant anymore, but I've struggled with the same problem on macOS using lualatex. For me, and the aforementioned combination, it was solved through luaotfload-tool, which is a part of the luaotfload -package (CTAN).

More specifically, running the following (sudo) fixed the problem:

luaotfload-tool --update


Jotting this down in case someone else has the same problem, finds this same question, and might be helped by this lua-solution.

• this does not answer the question, at minimal, add how to use luaotfload-tool to solve the original problem – user4686 Jan 25 '19 at 16:02
• @jfbu Done. (I had the exact same error as reported by the op. For me, the problem was resolved as described.) – krissen Jan 25 '19 at 16:23
• for the record I was once advised to do luaotfload-tool --force --update -vvv --cache=purge. – user4686 Jan 25 '19 at 16:39
• @jfbu I can imagine scenarios where that might be required. In my case, when running the tool it appeared there wasn’t even a database to begin with. (So no need for —force`, in that case.) – krissen Jan 25 '19 at 16:44
• not even a database? it is created on the first usage of lualatex on a document with fontspec – user4686 Jan 25 '19 at 16:49