I just installed MacTex 2018 but when I ran for instance pdflatex main.tex it does not call the executable produced by the MacTex just installed. Instead it calls an apparently old executable with the same name located at /usr/local/bin/pdflatex and the error -bash: /usr/local/bin/pdflatex: Bad CPU type in executable results. The pdflatex and other TeX-related executables produced by the new MacTex are located at /Library/TeX/texbin/. Now executing echo $PATH does show that the path of the old pdflatex is listed before the path of the new one thus the former is called. But how do I set the terminal so that all TeX-related command will be referred to the newly installed MacTex and delete all of the old TeX commands?. I checked the path to the old executable and there are multiple files whose name contains "tex" and I don't know whether all of these could just be rm-ed.

EDIT: I obtained MacTex by downloading the full package from TUG website and run the installer. I did not install a separate front-end since MacTex already installs TexShop as it says in the website. Unfortunately I don't know where the old TeX comes from because it is an iMac in my laboratory that I am using but listing all "tex" containing files in the /usr/local/bin/, the resulting files dates range from 2004 to 2008. The macOS version is El Capitan 10.11.

  • Please tell us more about (a) which version of MacOS is installed on your system, (b) which front-end editor you use (TeXworks? TeXshop? something else?), and (c) how you installed MacTeX2018. E.g., did you download the full 3.2GByte version from tug.org/mactex/mactex-download.html and run the installer program? If not, what did you do? Also, which older versions of MacTeX are on your system? FWIW, versions 2015, 2016, 2017, and 2018 are all installed on my system; after I installed version 2018 using the installer program, I experienced no problems of the variety you describe. – Mico Sep 19 '18 at 6:16
  • I edited the question to incorporate your question. By the way I am aware that older Mactex versions will have all its files isolated in /usr/local/texlive/xxxx but the existing versions in my mac are 2012, 2016, and 2018 whereas the executables described in my problem dated at most recent 2008. – nougako Sep 19 '18 at 6:27
  • I don't know where really old versions of MacTeX used to get installed or were supposed to be installed. I'm frankly surprised that versions 2008 and older would even run on your system. (I'm assuming that a reasonably up-to-date version of MacOS is installed on the iMac.) Anyway, it's probably a very good idea to blow away the executables from 2004 to 2008. TeX, LaTeX, and friends have all changed rather significantly since 2008... – Mico Sep 19 '18 at 6:35
  • My iMac runs on macOS 10.11, forget to mention that in the edits. Well, that's part of my question actually. I am not sure whether it is really problem-free to just remove those old tex executables. As I said there are many of them in /usr/local/bin/, I am concerned whether removing them will cause any system-wide failure, at least on tex related processes. – nougako Sep 19 '18 at 6:40
  • 1
    See Where is PATH modified to include /usr/texbin?. I think this should solve your problem. Also Checking and removing multiple MacTex installations on removing older stuff. – Alan Munn Sep 19 '18 at 13:09

In your home directory, there will be a hidden file called .bashrc. Open this with your favourite text editor, and delete the location of the old TeX binaries from the path definition. Close the terminal and open a new one. You should now find that

which pdflatex

returns the location of the newer binary. Since the old distribution doesn't work, it's hard to see any downside to simply deleting it.

  • I am home now so I cannot open .bashrc file in my lab's iMac but I remember I also checked inside that file and the path to the old binaries was not defined there. The path to the old binaries are actually defined as the system-wide path, it is stored in the PATH environment variable. I cannot remove this path from PATH because there are other important binaries such as compilers in the same directory as the old tex binaries. – nougako Sep 19 '18 at 12:03
  • I only partially solved this issue by overriding using alias so that I define an alias pdflatex to the new pdflatex path in .bash_profile. Compilation from terminal such as pdflatex main.tex is now successful but the compilation from inside my emacs editor where I did most of my editing still fails because emacs still calls the path to the old binaries. I feel that the old binaries in some way need to be just removed so that any other program that uses its path will solely be redirected to the new one. – nougako Sep 19 '18 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.