[R-SIG-Mac] Feature request: install R in ~/Library/Frameworks

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 7 11:22:38 CET 2017


On 07/02/2017 09:02, 美彦 馬場 wrote:
> Hi,
>
>> On Feb 7, 2017, at 17:46, Gábor Csárdi <csardi.gabor at gmail.com> wrote:
>>
>> Hi all,
>>
>> I realize that this is not the typical use case on macOS, but for my work,
>> it would be great to be able to install R into ~/Library/Frameworks.
>>
>> This would allow having different R versions for different users.
>>
>> I am not sure how difficult this would be to implement. I can see that some
>> paths in scripts and makefiles are hardwired to /Library/Frameworks. Is
>> there anything more, perhaps in the binaries as well?
>
>
> I install R with Fink, which allows you to install R-3.3, R-3.2 and R-3.1.  Each of them looks for files in /sw/Library/Frameworks/R.framework/Versions/3.3, 3.2 and 3.1 respectively.  Also, CRAN packages for different R versions are installed separately.

Well, you have missed the point.  R itself allows you to do that: do 
read 'R Installation and Administration'.

The reason to install R as a framework is to use R.app (and it is no 
longer the default for a source build).  And it is R.app which is tied 
to /Library/Frameworks/R.framework (and the 'Current' version).  Even 
though there is a Rswitch utility to switch the version R.app invokes, 
it is unreliable as R.app is built against a particular R version and 
may well crash if used with another.  R.app is not itself versioned, and 
there is no way to install it telling it to link to a particular version 
of the R framework.

For use as 'R' from a terminal, multiple CRAN distributions (of 3.x.y 
for different 'x') can easily be installed and used together: that is 
§4.3 of the manual.

Quite a lot of trouble has been taken to avoid the 'R' front-end script 
on macOS, and that does involve hard-coding the installation path in 
many places in the binary distribution.  For example

otool -L 
/Library/Frameworks/R.framework/Resources/library/Matrix/libs/Matrix.so
/Library/Frameworks/R.framework/Resources/library/Matrix/libs/Matrix.so:
	Matrix.so (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/3.3/Resources/lib/libRlapack.dylib (compatibility version 3.3.0, current version 3.3.2)
	/Library/Frameworks/R.framework/Versions/3.3/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/3.3/Resources/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/Library/Frameworks/R.framework/Versions/3.3/Resources/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)

I do not recall how much of this is done by the R scripts for installing 
to a framework and how much by the scripts used to build the installer 
(although AFAIR libgfortran.3.dylib is part of the latter).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-SIG-Mac mailing list