0

I have been using Sweave for quite sometime on my system using RStudio. However, I recently upgraded my Mac OS from Lion to Mavericks.

This caused several issues: First, RStudio was not able to locate the R library, and it just wont start. I reinstalled RStudio, but still got the same issue. So I reinstalled both R and RStudio, and then RStudio started to work.

And now, RStudio is still not able to locate TeX installation, and gives me the following warning: "No TeX installation detected. Please install TeX before compiling."

This will probably get fixed by a reinstall, but I would prefer to avoid a fresh download of TeX (~2.3G).

Any ideas on how to resolve this?

Shambho
  • 3,250
  • 1
  • 24
  • 37
  • Your best bet is to do the download (or pull the MacTeX DMG/pkd off of a Time Machine backup) and re-install. Even if you "repair" the install, enough was changed that you might get hit with something missing right when you don't have time to do the re-install. (I had to do this after the update, so I feel your pain) – hrbrmstr Apr 22 '14 at 20:39
  • The part where RStudio cannot locate the TeX installation just happened to me with upgrade to OS X El Capitan (10.11.3). Tried installing latest RStudio version (0.99.879) but still have same message. Downloading latest mactex to see if that will help. – Brian D Feb 16 '16 at 22:20

1 Answers1

2

RStudio expects pdflatex to be on the system path (i.e. entering Sys.which("pdflatex") at the R console should return the path to pdflatex).

You can fix the problem by getting pdflatex back on the system path:

  1. Find the path where pdflatex is installed on your system--likely /usr/texbin, but use find /usr -name pdflatex if you need help.
  2. Create a file called TeX in /etc/paths.d that contains this path.

For example:

$ sudo -s "echo /usr/texbin > /etc/paths.d/TeX"

You'll need to restart to apply the changes.

Jonathan
  • 8,497
  • 41
  • 35
  • I just went ahead and downloaded the MacTex. Thanks for the answer though!! – Shambho Apr 22 '14 at 22:40
  • 1
    I think mactex installs into `/usr/textbin` and I think that gets wiped out when you upgrade. – hadley Apr 23 '14 at 01:45
  • @hadley Indeed. I couldn't find a `/usr/textbin` folder after upgrade to El Capitan. The closest I could find were `/bibtex/` and `/tex/` folders in `/Library/TeX/Local/`. Also `Sys.which("pdflatex")` couldn't find anything. I found the following PDF from mactex folks which contains some potentially useful info: https://tug.org/mactex/UpdatingForElCapitan.pdf – Brian D Feb 17 '16 at 14:45
  • Following commands from pg. 4, section 8 worked for me: `cd /Library/TeX` `sudo ln -s Distributions/Programs/texbin texbin` `echo "/Library/TeX/texbin" >~/Desktop/TeX` `sudo cp ~/Desktop/TeX /etc/paths.d/TeX` "(giving your Admin password when requested) in the Terminal application. You can then delete the TeX file on your Desktop. Note: it’s advisable to copy and paste the commands to Terminal." – Brian D Feb 17 '16 at 14:52