Is there a way to run the --shell-escape command for the LuaLaTex engine in Texshop? I know there are editable TEX and Latex commands in the Texshop settings under Engine->pdfTeX settings, but I do not see anything for the LuaLaTeX engine.

enter image description here

1 Answer 1


If you always use lualatex as your default engine, you can simply replace the LaTeX engine default line in the preferences to read

lualatex --file-line-error --synctex=1 --shell-escape

I wouldn't really recommend this route, since it's probably best to only use --shell-escape when you absolutely need it, rather than make it the default.

I just have an Engine file to do this, or use the arara engine. Save the following file as lualatex-shell.engine in ~/Library/TeXShop/Engines.


set path= ($path /usr/texbin /usr/local/bin)
lualatex --shell-escape --file-line-error --synctex=1 "$1"

In the Terminal type:

chmod +x ~/Library/TeXShop/Engines/lualatex-shell.engine

Then restart TeXShop and you can invoke it either by choosing it from the Program item in the Macros menu, or by adding a magic comment line:

% !TEX TS-program = lualatex-shell

Alternatively, you can use the arara engine, and add shell-escape as one of the options. You may need to move the arara engine from the Inactive folder to the main Engines folder (and restart TeXShop) if it doesn't appear in your list of Engines.

% !TEX TS-program = arara
% arara: lualatex: {shell: true}
  • Hi, I have the same problem. I have done all your steps of the first solution. but still get an error: Module lyluatex Error: LilyPond could not be started. (lyluatex) Please check that LuaLaTeX is started with the (lyluatex) --shell-escape option, and that 'program' (lyluatex) points to a valid LilyPond executable. (lyluatex) on input line 10 Nov 23, 2023 at 13:24
  • stack traceback: [C]: in function 'error' ...ocal/texlive/2023/texmf-dist/tex/latex/base/ltluatex.lua:110: in function < ...ocal/texlive/2023/texmf-dist/tex/latex/base/ltluatex.lua:109> (...tail calls...) ./lyluatex.lua:1106: in method 'process' [\directlua]:1: in main chunk. \ly@compilescore ...directlua {ly.score:process()} l.10 \end{lilypond} Nov 23, 2023 at 13:24
  • The lilypond command works in frescobaldi, so it is not a problem with that code. Pls note I am not a TeX expert, so please keep it simple if you can help ! Nov 23, 2023 at 13:26
  • @Oбжорoв Since you're trying to combine using lualatex with lilypond, I would recommend asking a new question, linking to this one. I don't think this is something that can be solved in the comments.
    – Alan Munn
    Nov 23, 2023 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .