2
votes

I have some problems with the emacs org-mode. When I use the command org-export-as-pdf in org-mode, I got the error:

/bin/bash: pdflatex: command not found [3 times]

I am a Mac OS X(10.7) user and the version of emacs is 24.2. I downloaded the Tex Live from the official website and it was installed at /usr/local/texlive. I knew the env variables of emacs shell is different from user's terminal, so I tried this command:

M-! $PATH 

it printed:

/bin/bash: /usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

then I typed some commands below:

$which pdflatex
/usr/texbin

$ln -s /usr/texbin/pdflatex /usr/bin

and then I turned back to emacs, and tried org-export-as-pdf again, the same problem still existed.
I am confused and I need your help ;-)

1
Check this answer: stackoverflow.com/a/2566945/605276 I'm calling that function in my .emacs for setting path.Juancho
@Juancho it worked pretty well, thanks ;-)Gizak

1 Answers

0
votes

Add the pdflatex directory to the Emacs PATH environment variable, instead of the symbolic link, e.g. add this to ~/.emacs:

(setenv "PATH" (concat (getenv "PATH") ":/usr/texbin"))

and source it again with M-x load-file and type ~/.emacs. And now C-c C-e lp in Org-mode works:

PDF file produced.

(Cross-posted on Unix.StackExchange.)