I updated my TeXLive distribution with the TeXLive utility that comes with MacTeX. However, I cannot get lualatex to run. Regardless of the document, after calling lualatex test.tex (say) I get the error message:

 (./texsx.tex[\directlua]:1: module 'lualatexquotejobname.lua' not
 found: no field package.preload['lualatexquotejobname.lua'] [kpse lua
 searcher] file not found: 'lualatexquotejobname.lua' [kpse C searcher]
 file not found: 'lualatexquotejobname.lua' no file
 '/usr/local/lib/lua/5.2/lualatexquotejobname.so' no file
 '/usr/local/lib/lua/5.2/loadall.so' no file
 './lualatexquotejobname.so' stack traceback: [C]: in function
 'require' [\directlua]:1: in main chunk. <everyjob> \directlua

Unfortunately, I could not fix this with any of the posts found on this forum, or somewhere else. Am I missing something obvious? Has anybody a fix for this?

  • Do you need the standalone Lua app? (Version 5.2.x, right?) What happens if you uninstall it completely and then recompile your TeX document?
    – Mico
    Commented Jan 2, 2018 at 3:37
  • 2
    can you show the full log (including luatex startup banners) and also what is which luatex (or the mac equivalent) are you sure you are running the texlive 2017 luatex? Commented Jan 2, 2018 at 9:15
  • 1
    The instruction \directlua{require("lualatexquotejobname.lua")} is part of \everyjob in the lualatex format. It seems that \directlua is calling /usr/local/bin/lua instead of the embedded one, or that some environment variable is improperly set.
    – egreg
    Commented Jan 2, 2018 at 11:29
  • 2
    @marmot Argh! You have something installed with MacPorts! I have long removed any trace of it from my machines.
    – egreg
    Commented Jan 2, 2018 at 11:40
  • 3
    @marmot Tell MacPorts to uninstall luatex. Then, when you have some time, uninstall MacPorts.
    – egreg
    Commented Jan 2, 2018 at 11:49

1 Answer 1


My problem was solved by comments by David Carlisle and @egreg, whom I really wish to thank at this point. This post is just for the records, in case someone else runs into similar problems. Apparently, lualatex got installed by another package manager. In my case, there was a version under


After removing this version (and starting a new shell), the correct version


gets invoked and the documents run through.

You must log in to answer this question.