problem with LaTex

Discussion in 'OS X Mountain Lion (10.8)' started by pj123, Jan 24, 2013.

  1. pj123 macrumors newbie

    Joined:
    Jan 24, 2013
    #1
    Hi, LaTex used to work flawlessly on my Mac (Mountain Lion). Suddenly today it stopped working and gave the error message:

    latex: Command not found.

    I didn't change anything to the system. After getting the above error message, I re-installed LaTex, but still got the error. Can anyone help? Many thanks!
     
  2. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #2
    Once installed, teTeX is an integral part of your OS. It cannot spontaneously stop working any more than OS X's built-in frameworks can spontaneously stop working.

    Two questions:
    1. How did you install LaTeX?
    2. Between the last time you used LaTeX and now, what have you done to your OS really?
     
  3. pj123 thread starter macrumors newbie

    Joined:
    Jan 24, 2013
    #3
    Hello! I didn't do anything to the system. There might be some kind of system update. Other than that, I am pretty sure that I didn't change anything.

    I installed LaTex using MacTeX.pkg downloaded from http://www.tug.org/mactex/index.html .

    Thank you!
     
  4. switon, Jan 25, 2013
    Last edited: Jan 26, 2013

    switon macrumors 6502a

    Joined:
    Sep 10, 2012
    #4
    RE: LaTeX and the PATH variable...

    Hi pj123,

    There could be several reasons why this happened. But basically the path to the TeX binaries must no longer be in your PATH variable. So to solve your problem, you have to re-add the proper path to your PATH variable.

    I use the MacTeX.pkg version of 2012 Tex Live, so it depends on which particular version you use and to where the binaries may be located. First check if you have a /usr/texbin directory on your boot drive, and if so, is there a "latex" executable in this directory? If this is the case, then you will need to add this directory to your PATH variable. You might use the following code to do so (execute this temporarily in the Terminal window that you wish to run LaTeX from):

    Code:
    PATH=/usr/texbin:$PATH; export PATH
    
    [It is important not to include any spaces besides the ones that I have included above.]

    If this works and you can now run LaTeX, then you might consider adding this line to your ~/.bashrc file, if you have one. Or make a bash shell script with this line in it to execute before you attempt to LaTeX anything.

    If you didn't find an /usr/texbin directory, then you might check for the /usr/local/texlive/2012/bin/x86_64-darwin directory and see if the "latex" executable is there. If so, then add this directory to your PATH variable via a bash command line similar to the above code line.

    If you are using Tex Live, then in your System Preferences there is a TeX Distribution pane in the Other line. Make sure that your TeXLive-2012 distribution is checked. If you are using TeX Live, then run the TeX Live Utility.app and under Actions do "Update All Packages".

    When you installed Tex Live initially, did you install it for all users? Have you changed your user account?

    Do you use Fink or MacPorts? These systems also have versions of LaTeX packages, and sometimes if you install something from Fink or MacPorts it will automatically install teTeX which may conflict with your Tex Live installation. For instance, if you install fig2ps in MacPorts it will install teTeX which includes its own LaTeX, and depending upon how your PATH variable is setup, the MacPorts "latex" may be executed instead of the Tex Live "latex". All of these things should be checked.

    Good luck,
    Switon

    P.S. If it is not your PATH variable that is giving you this problem, then you may have more serious issues. Find the "latex" executable on your system...it is probably a link to the "pdftex" executable. Try running this executable directly from the command line, with something like:
    Code:
    /usr/texbin/latex testlatexfile.tex
    
    If this works, then do a "which latex" and see if it finds your latex. If not, then you are back to a PATH problem.
     
  5. pj123 thread starter macrumors newbie

    Joined:
    Jan 24, 2013
    #5
    Hi switon, Thank you so much! I tried your diagnostic method and found out the problem. It was a path problem. I have export PATH=/usr/texbin:$PATH" in the .bash_profile. That used to work. Now following your suggestion, I added the path to .bashrc . It worked! Thank you again.
     
  6. switon, Jan 25, 2013
    Last edited: Jan 26, 2013

    switon macrumors 6502a

    Joined:
    Sep 10, 2012
    #6
    RE: Latex and thanks...

    Good luck with the latex,
    Switon
     

Share This Page