I am writing my phd thesis now, and all these while I have used texshop in mac os X (mavericks). I have compiled in Lualatex through texshop (or even texworks) and the file compiles fine, but I have a problem compiling it from the command line and get many errors like this :

   lualatex --shall-escape Report.tex 
   ! Package fontenc Error: Encoding file `lgrenc.def' not found.
   (fontenc)                You might have misspelt the name of the encoding.

    See the fontenc package documentation for explanation.
    Type  H <return>  for immediate help.

Very typical latex compilation errors. My simple question is how to compile using lualatex from the command line?

  • 4
    withou seeing the source it is hard to tell, but a couplw of thing jump out. It shpuld be --shell-escape, and you should not be using fontenc with lualatex. Apart from that, the error ypu have shown are not related to lualatex, and pdflatex would probably crash the same way.
    – ArTourter
    Nov 5, 2015 at 1:10
  • 3
    You have been using fontenc with lualatex this whole time? This is not (usually) recommended! Or is some package loading it "behind the scenes"? It is hard to tell without an actual, but minimal .tex file....
    – jon
    Nov 5, 2015 at 1:12
  • 1
    Welcome! You almost certainly don't want to be using lgrenc.def with LuaLaTeX in any case... But, again, without code it is hard to say. That said, the error you are getting is odd. lgrenc.def should be found. Loading it may well cause problems. But there should not be a problem loading it. Hard to say more without some more details, though. How did you install TeX exactly?
    – cfr
    Nov 5, 2015 at 2:50
  • 1
    My impression is that you have two TeX Live distributions, one installed as MacTeX and the other, probably, with MacPorts. Can you add the output you get from giving which lualatex from the terminal?
    – egreg
    Nov 5, 2015 at 7:36
  • 1
    @AyanMitra As I suspected, you have a MacPorts TeX Live that kicks in. See tex.stackexchange.com/questions/271525/…
    – egreg
    Nov 5, 2015 at 8:44

1 Answer 1


As mentioned by others in the comments, I found the macports installed binaries

port provides /opt/local/bin/latex

Then simply uninstall it

sudo port uninstall --follow-dependents texlive-bin

Now if you do which lualatex it shows


The other shortcut I realised could be directly accessing the mactex binaries by

/usr/local/texlive/2012/bin/x86_64-darwin/lualatex  Report.tex

and put an alias to this path and then simply calling lualatex will invoke the texshop used same binaries, and that's what I am doing now and everything works fine.

  • 1
    You may want to look into updating your TeX distribution to MacTeX2015. LuaTeX and LuaLaTeX, in particular, have changed significantly since MacTeX2012.
    – Mico
    Nov 5, 2015 at 17:17

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.