# LaTeX Command line in OS X

I need to run latex from command line for a project on OS X. LaTeX is installed in:

/usr/local/texlive/2010

in the bin folder there are three folders:

/usr/local/texlive/2010/bin/universal-darwin
/usr/local/texlive/2010/bin/win32
/usr/local/texlive/2010/bin/x86_64-darwin

both "universal-darwin" and "x86_64-darwin" have the executable file "latex". I ran this line in both of these directories and received the same error.

./latex /Users/fluid/Desktop/sample.tex

Here is the error

fluid:x86_64-darwin fluid$./latex /Users/fluid/Desktop/sample.tex This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) restricted \write18 enabled. entering extended mode ! I can't write on file sample.log'. (Press Enter to retry, or Control-D to exit; default file extension is .log') Please type another transcript file name: and here is the file sample.tex \documentclass[12pt]{article} \begin{document} \begin{center} Sample \LaTeX{} file \end{center} Here is an equation $$f(x) = e^x$$ \end{document} How can I make this work? - @Fluid, There is however an alternative to run the file with TeXworks that comes with MacTeX. It's been running fine on my MBP. Your code works there. I just tried it. I never try on terminal. – Khaaba Sep 28 '12 at 4:31 – Peter Grill Sep 28 '12 at 4:54 What does the terminal answer after you issue "echo$PATH"? (Without the quotes) – egreg Sep 28 '12 at 6:26
@Mico: I think your comment should be an answer. – mpg Sep 28 '12 at 6:28