How can I access the LaTeX commands from the terminal? I just installed MacTeX onto Yosemite and it installed everything in usr/local/texlive

However if I am in Terminal and try to compile a LaTeX file with pdflatex foo.tex, it cannot find the LaTeX tools. Further whereis pdflatex returns no results.

If I specify the entire path of pdflatex (e.g., /usr/local/texlive/2014/.../bin/pdflatex) it all works well.

How can I get the LaTeX tools to work from the terminal without specifying the entire path?
To get the LaTeX tools to run from the command line, you need to add the path to your pdflatex to your executable search path. To do this, you'll need to edit the .bash_profile file in your home directory. Open the file in a plain text editor (e.g. vi, emacs, bbedit) and add this line at the bottom:

PATH=/usr/local/texlive/2014/.../bin:$PATH


where /usr/local/texlive/2014/.../bin is the path you typed in your example to get pdflatex to run.



An aside

whereis only returns results from system-installed executables. which looks in the entire path. e.g. on my machine:

~ 503   whereis ruby
/usr/bin/ruby
~ 504   which ruby
/Users/steve/.rvm/rubies/ruby-2.1.2/bin/ruby