[R-SIG-Mac] Multiple R versions: set Current via symbolic link: permissions?

Simon Urbanek simon.urbanek at r-project.org
Tue Oct 11 16:38:47 CEST 2011


On Oct 11, 2011, at 10:35 AM, Marius Hofert wrote:

> 
> On 2011-10-11, at 16:19 , Simon Urbanek wrote:
> 
>> 
>> On Oct 11, 2011, at 6:24 AM, Marius Hofert wrote:
>> 
>>> Hi,
>>> 
>>> I have multiple R versions installed and would like to switch between them via setting the symblic link "Current". To make this a bit more convenient, I defined two "aliases" in .bashrc:
>>> 
>>> alias R2.13='d=/Library/Frameworks/R.framework/Versions; rm $d/Current; ln -s $d/2.13 $d/Current'
>>> alias R2.14='d=/Library/Frameworks/R.framework/Versions; rm $d/Current; ln -s $d/2.14 $d/Current'
>>> 
>> 
>> Try
>> 
>> ln -sfn 2.13 /Library/Frameworks/R.framework/Versions/Current
>> 
> 
> Dear Simon,
> 
> thanks, I put it in the alias. It now looks like this:
> alias R2.13='d=/Library/Frameworks/R.framework/Versions; rm $d/Current; ln -sfn $d/2.13 $d/Current'
> (and similarly for R 2.14)
> 
> 
>> You'll need to be admin of the computer, otherwise you'll need sudo
> 
> If I execute (in a new shell, as usual) R2.13, I (still) get:
> 
> bash-3.2$ R2.13
> rm: /Library/Frameworks/R.framework/Versions/Current: Permission denied
> ln: /Library/Frameworks/R.framework/Versions/Current: Permission denied
> 
> So the obvious would be to "sudo R2.13", but I obtain:
> 
> bash-3.2$ sudo R2.13
> Password:
> sudo: R2.13: command not found
> 
>> or change permissions. Note that for symlinks you'll need extra -h in chown otherwise you're changing ownership of the target not the link.
> 
> This I also realized :-) I tried that:
> sudo chown -h myuser /Library/Frameworks/R.framework/Versions/Current
> 
> bash-3.2$ ls -al
> total 8
> drwxrwxr-x  5 root     wheel  170 Oct 11 15:54 .
> drwxrwxr-x  9 root     wheel  306 Oct 11 11:38 ..
> drwxrwxr-x  8 root     wheel  272 Oct 11 12:16 2.13
> drwxrwxr-x  6 root     wheel  204 Oct 11 11:38 2.14
> lrwxr-xr-x  1 myuser  wheel   45 Oct 11 15:54 Current -> /Library/Frameworks/R.framework/Versions/2.13
> bash-3.2$ 
> 

You permissions are odd - this is not what installed R looks like, you should see

ginaz:Versions$ ls -l
total 8
drwxrwxr-x  6 root  admin  204 Mar 26  2010 2.12
drwxrwxr-x  6 root  admin  204 Jul 12 15:44 2.13
drwxrwxr-x  6 root  admin  204 Oct  2 11:01 2.14
drwxrwxr-x  6 root  admin  204 Oct  3 12:05 2.15
lrwxr-xr-x  1 root  admin    4 Oct  3 12:05 Current -> 2.15

so run
chown -Rh root:admin  /Library/Frameworks/R.framework/
followed by

to fix that.

Cheers,
Simon



> => okay, root was changed to myuser, that's good. But again, I get 
> 
> bash-3.2$ R2.13
> rm: /Library/Frameworks/R.framework/Versions/Current: Permission denied
> ln: /Library/Frameworks/R.framework/Versions/Current: Permission denied
> 
> 
> 
>> If in doubt (ie., you messed with permissions before), run sudo chmod g+w -R /Library/Frameworks/R.framework
> 
> okay, thanks a lot, that's good to know.
> 
>> 
>> Cheers,
>> Simon
>> 
>> 
>>> On executing R2.13 in the terminal, I get:
>>> rm: /Library/Frameworks/R.framework/Versions/Current: Permission denied
>>> ln: /Library/Frameworks/R.framework/Versions/Current/2.13: Permission denied
>>> 
>>> If I chown Current, I still get:
>>> rm: /Library/Frameworks/R.framework/Versions/Current: Permission denied
>>> 
>>> I (bad) solution is to put in "sudo" in the alias... 
>>> 
>>> How is it done correctly? 
>>> 
>>> Cheers,
>>> 
>>> Marius
>>> 
>>> PS: I also posted it for future reference, I've only found the idea of using ln -s on the help pages/FAQ, but not how to get around the permission issue.
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>>> 
>> 
> 
> ETH Zurich
> Dr. Marius Hofert
> RiskLab, Department of Mathematics
> HG E 65.2
> Rämistrasse 101
> 8092 Zurich
> Switzerland
> 
> Phone +41 44 632 2423
> marius.hofert at math.ethz.ch
> http://www.math.ethz.ch/~hofertj
> 
> 



More information about the R-SIG-Mac mailing list