I am using recently updated MacTex Distribution 2016 on a MacBook Pro Mid 2009 and Texmaker is my editor. I searched a long time for a solution to this problem but nothing really helped, so I give it another shot here! I must be missing something simple, since the very easy MWE won't work.
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot[domain=-2*pi:2*pi, samples=100]{cos(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
When I run on pdflatex
"pdflatex" --shell-escape -synctex=1 -interaction=nonstopmode %.tex
it works like a charm. However when I run LuaLaTeX
"lualatex" --shell-escape -interaction=nonstopmode %.tex
it gives error:
! Package tikz Error: Sorry, the system call 'lualatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "main-figure0" "\def\tikzexternalrealjob{m
ain}\input{main}"' did NOT result in a usable output file 'main-figure0' (expec
ted one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system c
alls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also name
d 'write 18' or something like that. Or maybe the command simply failed? Error
messages can be found in 'main-figure0.log'. If you continue now, I'll try to t
ypeset the picture.
See the tikz package documentation for explanation.
Why is that? Thanks in advance!