6

Does anyone have a link to clear instructions on how to install and configure the necessary latex packages to build R packages on a mac?

I have some scripts for building and checking R packages on a mac server. They seemed to work fine, but after upgrading to R 3.1.3, many of the packages started failing with

Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  Running 'texi2dvi' on 'networkVignette.tex' failed.
Messages:
sh: /usr/local/bin/texi2dvi: No such file or directory
Calls: <Anonymous> -> texi2pdf -> texi2dvi
Execution halted

I found a thread which seemed to suggest I need a more recent version texinfo (5.2) than what is installed by default. And apparently I've I've got the wrong version installed in the wrong location?

which texi2pdf
/sw/bin/texi2pdf

texi2pdf --version
texi2pdf (GNU Texinfo 5.1) 5234

(same version is reported when running system('texi2pdf --version') in R )

This thread gives a link to a texinfo 5.2 source collection:

http://r.789695.n4.nabble.com/R-CMD-build-looking-for-texi2dvi-in-the-wrong-place-R-devel-td4701706.html

But I'm not familiar with installing executable from a tar.gz file on a mac. The R mac help pages I found suggest installing MacTex, which I tried but that didn't seem to help.


** Update: ** additional discussion of related problems on R-SIG-mac mailing list: https://groups.google.com/forum/#!topic/r-sig-mac/xjyuFdl5Ezk


Update: Here is where I'm currently at:

  1. I removed my /sw directory to uninstall fink and all of its packages (couldn't figure out how to upgrade it)

  2. installed homebrew

  3. brew install texinfo installs version 5.2 the package,

but generates the message This formula is keg-only, which means it was not symlinked into /usr/local and actually installs in in /usr/local/Cellar/texinfo/5.2/bin which means it is not on the path and R won't find it.

  1. manually symlink each of the texi2pdf, texi2dvi , etc as vincent suggests (this is because R has the /usr/local/bin location as default in the tools::texi2dvi function?

  2. edited the /etc/paths file on the system to add /usr/local/bin so that finds the brew installed 5.2 version before it finds it before the osx system supplied version 4.6 version. This may not be necessary because R has it hardcoded?

All of this gets rid of the "can't find texi* errors", and gives me a bunch of latex errors (which I don't see on unix and windows builds) so I'm still kind of stuck.

This seems very hackish, so there must be a cleaner way? But it sounds like stuff with tex and mac is very sketchy at the moment? https://tex.stackexchange.com/questions/208181/why-did-my-tex-related-gui-program-stop-working-in-mac-os-x-yosemite

Community
  • 1
  • 1
skyebend
  • 1,079
  • 6
  • 19
  • I just tried installing texinfo using brew. The message it gives back is "Mac OS X already provides this software and installing another version in parallel can cause all kinds of trouble." Installing from source may also not be a good idea. Not sure what the solution is at this point. – Vincent Mar 23 '15 at 23:35
  • Note that things seem different(-ly broken) after upgrade to OSX El Capitan. MaxTeX install is now 5.2, and seems to be in /usr/local/bin ... but still fails – skyebend Nov 16 '15 at 23:46

3 Answers3

2

This worked for me on Mavericks and on Yosemite:

ln -s /usr/bin/texi2dvi /usr/local/bin/texi2dvi
ln -s /usr/bin/texi2pdf /usr/local/bin/texi2pdf
Vincent
  • 5,063
  • 3
  • 28
  • 39
0

On my Lion system both the command which texi2pdf at a Terminal/bash prompt and from a R.app GUI prompt tell me that I have that program in:

system("which texi2pdf")
#/opt/local/bin/texi2pdf

That is a location typical for MacPorts installation. I think the /usr/local/bin/ is what the binary R version "expects". I'm not really that UNIX savvy, but I think the you can modify the PATH environment variable so that R will be able to find your installation. (Whether it will be compatible I cannot say since so much detail is missing from your question.) My Tex installation is MacTex, which I got from https://www.tug.org/mactex/. I admit to having a cobbled-together system:

system("echo $PATH")
# /opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin

That gets set at the beginning of an R session because this is the first line in my .Rprofile-(invisible)file:

Sys.setenv(PATH="/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin")

I think /sw/bin/ installations signify a fink install, which I have had very little success with. Simon Urbanek suggests not using any package installers, but then leaves the rest of us UNIX weenies very little in the way of worked examples of how to install that various external packages that underpin the many interesting and oh-so-useful R packages. So I feel your pain, but I'm not running for President.

So I suppose you could try this at your R console before again attempting one of the earlier unsuccessful installs:

Sys.setenv(PATH=paste( Sys.getenv()$PATH, # should be the character string of the $PATH
                       "/sw/bin/", sep=":")
            )

Wish I could offer guarantees, but if it breaks the only guarantee is that you get to keep all the pieces.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • thanks, I'll try this. However, since this if for testing, I was hoping to find some sort of CRAN-approved "vanilla" configuration. Maybe it doesn't exist – skyebend Mar 23 '15 at 14:55
0

I ran into a similar error message using Mavericks 10.9.5 (factory configured) and R 3.1.

It turns out that I didn't have pdfLaTex. I went to this page: http://tug.org/mactex/ and downloaded the MacTex installation package. It's big (>2GB) but after I installed it, my R package build problems went away.

Hope this might be helpful to anyone else who runs into this error message.

Mac471
  • 423
  • 5
  • 16