[Tex/LaTex] MacTex – How to compile via command line?


I'm new to LaTeX/TeX and recently installed MacTeX on my MacBook. Everything seems to work fine (I'm able to create and typeset files with TeXShop).

Now I want to compile some files via command line and read that I need to change into the projects directory and execute pdflatex my_file.tex. Sadly MacTeX doesn't seem to ship pdflatex. which pdflatex returns nothing.

Should pdflatex be included in MacTeX and my installation is broken?
I already reinstalled MacTeX and checked the MD5 hash to verify that I have the right MacTeX installer…

What can I do to compile my .tex-files?

Best Answer

I use


and it works perfectly fine for me.

For instance, use the below command to compile your tex file and generate the pdf:

xelatex --interaction=batchmode file_name.tex 2>&1 > /dev/null;open file_name.pdf

Remove the

2>&1 > /dev/null

part if you want to see the error messages.I am okay with them not being there.

Related Question