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
'/usr/local/lib/lua/5.2/lualatexquotejobname.so' no file
'./lualatexquotejobname.so' stack traceback: [C]: in function
'require' [\directlua]:1: in main chunk. <everyjob> \directlua
{require("lualatexquotejobname.lua")}
``````

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 Jan 2 '18 at 3:37
• 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? – David Carlisle Jan 2 '18 at 9:15
• 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 Jan 2 '18 at 11:29
• @marmot Argh! You have something installed with MacPorts! I have long removed any trace of it from my machines. – egreg Jan 2 '18 at 11:40
• @marmot Tell MacPorts to uninstall `luatex`. Then, when you have some time, uninstall MacPorts. – egreg Jan 2 '18 at 11:49

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
``````/opt/local/bin/lualatex
``````/Library/TeX/texbin/lualatex