[R-SIG-Mac] How to start two different versions of R on a Mac (in emacs)?

Simon Urbanek simon.urbanek at r-project.org
Wed Sep 14 20:39:36 CEST 2011


On Sep 14, 2011, at 2:25 PM, Hofert Jan Marius wrote:

> Dear expeRts,
> 
> I recently switched to emacs (aquamacs) and I am amazed by its capabilities. I used to use RSwitch to switch between R-2.13 and R-2.14. Since I am now able to start R in different frames of emacs, I was wondering if I can simply start R-2.13 in one frame and R-2.14 in another frame. 
> 
> On experimenting, the first thing I realized was that in a terminal, I only have "R", "R32" and "R64" available; so no "R-2.13.32bit", "R-2.14.32bit", "R-2.13.64bit", "R-2.14.64bit" [or similar]. If I start "R", it starts the version that RSwitch has selected. But that means I can't start different R versions at the same time... However, I know that it works on Linux, so is there a Mac solution, too? It would be nice if one is not required to use RSwitch but can simply choose in emacs which R version should be started. 
> 
> The first step seems to be to locate the different installed R versions, which should probably be in /Library/Frameworks/R.framework/Versions/2.13/Resources and /Library/Frameworks/R.framework/Versions/2.14/Resources. But if RSwitch points to R-2.14 and I start the R version in the former directory (so R-2.13), it starts R-2.14 anyway... 
> 


For the command-line R (and only the command line R!) you can simply create a copy of the R launcher script and replace all occurrences of the R home path with the full *versioned* home path, so for example for 2.13 you would use something like

sed 's:/Library/Frameworks/R.framework/Resources:/Library/Frameworks/R.framework/Versions/2.13/Resources:g' R > R-2.13

This will make your R script independent of the current framework version. However, note that some things will break - for example you won't be able to compile packages properly. For details see the FAQ:
http://r.research.att.com/bin/macosx/RMacOSX-FAQ.html#Why-is-R_002ehome_0028_0029-not-versioned_003f

Cheers,
Simon



More information about the R-SIG-Mac mailing list