Mac – Difference between using ⌘ – space vs ‘open -a’ in terminal

applicationsemacskeyboard

I noticed a difference when compiling a latex document within emacs, but I think this is really a mac question.

When I open emacs via ⌘ – space and then type C-c C-c, instead of compiling with pdflatex, the minibuffer proposes 'Command[\doc-view]', and if I enter 'pdflatex', the TeX-shell (within emacs) tells me 'pdflatex: command not found'.

When I open emacs from a terminal window and type 'open -a emacs', it works fine.

Why is that?

Best Answer

The problem you are having is a constant for Emacs. It's due to Emacs relying on a couple of things that are set in a bash shell that aren't available in the GUI.

The most notable of these is the PATH variable. That's why pdflatex isn't being found.

Check https://www.emacswiki.org/emacs/EmacsApp for a better explanation and some things you can do to make it easier.