Skip to content

Instantly share code, notes, and snippets.

@dill
Last active October 25, 2015 19:09
Show Gist options
  • Save dill/277028c6e5d654cac52a to your computer and use it in GitHub Desktop.
Save dill/277028c6e5d654cac52a to your computer and use it in GitHub Desktop.
Getting Yosemite and R to play nice...

Getting Yosemite and R to play nice

Here are some tips on getting R development working with Yosemite. Contribute what you know below and I'll add it in.

homebrew

I went ahead and re-installed all of my homebrew. You can find out what you have installed with

brew leaves

so you can make a note of what you want to re-install. You can then uninstall with this script.

@ateucher suggests (in the comments) that one moves the whole /usr/local/ per "Option 1" on this page.

tcltk/X11 issues

Seems like some of the libraries installed by XQuartz get hammered during installation. You need to download the package and re-install. XQuartz homepage.

(From Peter Dalgaard in R-SIG-Mac)

By default, my plot device was set to be X11 (which looks pretty horrible). Adding the following line to my .Rprofile got me back to Quartz device plotting:

options(device="quartz")

Why is happens is explained by Simon Urbanek in this R-SIG-Mac post.

LaTeX/MacTeX/TexLive

Seems to get hammered too, so need to download (the GIANT installer) again... http://tug.org/mactex/. If you haven't installed Yosemite yet, there are some tips on "avoiding the problem" (plus other tips).

knitr/pandoc

Building a PDF in RStudio gives the following error:

pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed with error 41
Execution halted

No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:

  Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup
  (NOTE: Be sure to download the Complete rather than Basic installation)

  Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

This Stack Overflow thread gives some (short term) solutions.

The recommendation being that you run RStudio from the command line

$ open /Applications/RStudio.app

and that this will ensure that the PATH environment variable is correctly forwarded to RStudio, so it will find LaTeX.

As @hadley points out in the comments, "R 3.1.2 or latest RStudio should fix any path problems."

@dill
Copy link
Author

dill commented Oct 23, 2014

@hadley
Copy link

hadley commented Nov 5, 2014

R 3.1.2 or latest RStudio should fix any path problems.

@PhillRob
Copy link

just updated all packages in r (well and having a recent TEX version) worked for me (Yosemite, Rstudio 3.9.2)

@jubilatious1
Copy link

Still had path problems with R.app GUI after update to R_3.1.3, for example, with finding pdflatex.
R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
Platform: x86_64-apple-darwin13.4.0 (64-bit)
[R.app GUI 1.65 (6913) x86_64-apple-darwin13.4.0]

Opening from the command line fixed:

$ open /Applications/R.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment