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

Simon Urbanek simon.urbanek at r-project.org
Fri Sep 16 02:30:48 CEST 2011


On Sep 14, 2011, at 3:02 PM, Hofert Jan Marius wrote:

> Dear Simon,
> 
> thanks for your help, that clarified a lot. 
> As I could read it is not "recommended" to make the adjustment. 
> 
> Can RSwitch be called from the command line? If so, one could at least create a command (or alias) "R-2.13" that first calls RSwitch and sets the version accordingly and then starts R. That would be quite convenient. 
> 

Actually, it's the other way around - switching versions is trivial from the command line simply using "ln" (see the FAQ) so obviously you can do that in the script. RSwitch is just a wrapper that allows you to do that from the GUI. But note that the issue is that the Current link can only be correct for one version, so you can use one or the other but not both at the same time. Setting R home to the versioned version allows you to use both at the same time but some issues remain (compiling packages etc.).

Cheers,
Simon


> 
> On 2011-09-14, at 20:39 , Simon Urbanek wrote:
> 
>> 
>> 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