I've installed MacTex 2017 but can't get anything to compile with XeTex (or LuaLatex). For example this minimal example:


Fails with the following output:

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
! Undefined control sequence.
l.26 \sys_if_engine_luatex:T

The output is basically the same whether I use latexmk or the xelatex command directly. I've tried reinstalling MacTex, and also reinstalling the fontspec package (based on suggestions from similar questions), but nothing seems to work. Can anyone suggest what might be wrong, or how to debug it further?

  • 3
    You have a local copy of l3kernel, etc., which is likely older than fontspec: please try moving these 'out of the way'. – Joseph Wright Feb 27 '18 at 12:51
  • That was exactly the problem! I'm not sure how old that ~/Library/texmf folder is, but clearing it out fixed the issue completely. Thanks! – hellobenallan Feb 27 '18 at 13:16

As pointed out by Joseph Wright, the problem was that a local user texmf directory was present which contained older package files which cause the error with fontspec. Moving (or deleting) the ~/Library/texmf directory fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.