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

Hofert Jan Marius marius.hofert at math.ethz.ch
Fri Sep 16 06:57:58 CEST 2011


On 2011-09-16, at 02:30 , Simon Urbanek wrote:

> 
> 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

Dear Simon,

thanks for helping.

I realized that setting it with ln is just a convenience [not having to click anything], but of course that does not imply that one can suddenly open two versions. I even tried and one runs into problems quite quickly.
That's a pity, I have to admit that this is the first time that the Mac is not behaving nicely and inferior to Linux. I don't have Linux installed but as far as I know from Linux users, they can have multiple versions installed *and* work with them in parallel. As one can read on http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Why-is-R_002ehome_0028_0029-not-versioned_003f : "The advanatage of this setup is that it is possible to install multiple R versions in parallel and they all will be fully functional ...". Obviously it is not an advantage in comparison to Linux systems. I was wondering about that, that's why I asked.

Cheers,

Marius 


> 
> 
>> 
>> 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