[R-SIG-Mac] /bin/sh: tar: command not found

Kasper Daniel Hansen khansen at stat.berkeley.edu
Sat Oct 4 16:53:40 CEST 2008


On Oct 3, 2008, at 15:55 , [Ricardo Rodriguez] Your XEN ICT Team wrote:

> Thanks Kasper,
>
> Kasper Daniel Hansen wrote:
>> You can print and set environment variables from within R by doing
>>
>> Sys.getenv("PATH")
>> Sys.setenv(PATH = "SOMETHING")
>>
>> When you start R from the command line it should inherit the PATH  
>> (although that depends on how you set it - and note that it looks  
>> as if you are using SH and not say BASH).
>>
>
> It is a bit weird to receive a message concerning sh. As far as I  
> know, I am using BASH. In fact, I have recently modified /etc/bashrc  
> to include some Maven variables. I now reads...
>
> *****
> sh-3.2# cat bashrc
> # System-wide .bashrc file for interactive bash(1) shells.
> if [ -z "$PS1" ]; then
>  return
> fi
>
> PS1='\h:\W \u\$ '
> # Make bash check its window size after a process completes
> shopt -s checkwinsize
>
> # Maven Settings
> export M2_HOME=/usr/local/apache-maven/apache-maven-2.1.0-M1
> export M2=$M2_HOME/bin
> export PATH=$PATH:$M2
> export MAVEN_OPTS=-Xmx600m
> sh-3.2#
>
> *****
> sh-3.2# echo $PATH
> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/ 
> apache-maven/apache-maven-2.1.0-M1/bin
> *****
>
> From R Console:
>
> *****
> > Sys.getenv("PATH")
>                              PATH
> "$M2:$PATH:/usr/local/bin"
> >
> *****


Ok, this is clearly wrong. As you can see in your output, this PATH  
does not contain /usr/bin where tar is. In my case I get
R> Sys.getenv("PATH")
                                                                                       PATH
"/Users/khansen/Bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/ 
texbin:/usr/X11/bin"

This looks like a failed attempt at setting the PATH somewhere. What  
you see is where similar to the syntax you use in your .bashrc file  
but with stuff jumbled a bit. So my wild guess is that you have tried  
setting your PATH somewhere else and that this gets picked up. Do you  
have a .profile file. In fact I would do something like

# cd
# grep PATH * .*
(star space dot star), to see if you are playing with the PATH  
somewhere else.

Are you on a multi-user system? (Could your sys admin have played with  
site-settings?)

My comment about BASH and SH was just based on your prompt. It is  
normal that R uses SH for its purposes, that is pretty standard.

The reason why people are talking about DevTools is that this is  
needed in order to compile from source. And a lot of tools are found  
in the DevTools. And most of us cannot remember if tar came from  
DevTools or with a standard Mac OS X. But I am pretty sure it is part  
of standard OS X.

Kasper


> From your comments, I've done...
>
> > Sys.setenv(PATH = "$M2:$PATH:/usr/bin:/usr/local/bin")
>
> And now the installation works smoothly...
>
> *****
> > install.packages("zoo",repos="http://R-Forge.R-project.org")
> trying URL 'http://R-Forge.R-project.org/bin/macosx/universal/contrib/2.7/zoo_1.6-0.tgz'
> Content type 'application/x-gzip' length 651045 bytes (635 Kb)
> opened URL
> ==================================================
> downloaded 635 Kb
>
>
> The downloaded packages are in
>   /var/folders/6h/6hyderV4GAmSiGLPDwB16k+++TI/-Tmp-//Rtmp8eeprZ/ 
> downloaded_packages
> > require(zoo)
> Loading required package: zoo
> *****
>
> So, I think the question could be, is R correctly inheriting PATH?  
> It seems that it is not able to understand the syntax $M2:$PATH:/usr/ 
> local/bin
>> Since you are installing a binary from Bioconductor under something  
>> I guess is the CRAN binary (I cannot be 100% with the info you are  
>> providing), it really should work. You should not need to have the  
>> DevTools installed.
>
> I required DevTools for several buildings here not related with R.
>
> Thanks for your help!
>
> Ricardo
>
> -- 
> Ricardo Rodríguez
> Your XEN ICT Team



More information about the R-SIG-Mac mailing list