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

Kasper Daniel Hansen khansen at stat.berkeley.edu
Sat Oct 4 21:57:36 CEST 2008


Ok, I think I know what went wrong now

The key information was that you are using R.app (the GUI) which was  
not clear to me until now.

First I would say however that you seem to be messing around a bit. In  
your previous email you said you had modified .bashrc to include the  
long PATH setting, but in your grep below, bashrc is not mentioned. So  
I assume you have deleted it in the meantime?

Anyways, you seem to have been playing around a bit with your  
environment variables and how to set them. In general graphical  
applications on OS X does not care about what you do in your .bashrc  
or .bash_profile, period. But you have still managed to kind of screw  
things up :). And whatever you do in your .bashrc or .bash_profile  
won't have any effect on R.app because it does not care about these  
files (so you may answer, how come that # open -a R.app ... worked?  
Well, that is because you launched R from inside Terminal, and in that  
case it inherits stuff from Terminal).

So what are the options for what you could have done
1) You have created an environment.plist variable inside inside  
~/.MacOS like described in the following note:
   http://developer.apple.com/qa/qa2001/qa1067.html
In order to check for this you could do something like
   # find ~/ -iname "environment.plist"
(this will take a while)

2) You have messed with your system wide settings in /etc. You could  
look for the M2 problem you have by doing
   # cd /etc
   #grep -R M2:

3) You have played with the R installation (unlikely)

If you are truly desperate, you could execute the grep command from /,  
but that will take ages.

So once you have located it, what is your fix?

0) delete or restore the file you located above
1) keep everything in .profile instead of .bashrc and .bash_profile
2) You may have to log out and log in again.
3) If you really want to use your apache-maven PATH in R, do the  
following: create a file called ~/.Rprofile and put the following in it
Sys.putenv(PATH=SOMETHING)
Thats is probably the best long term solution.

Kasper

On Oct 4, 2008, at 9:24 , [Ricardo Rodriguez] Your XEN ICT Team wrote:

> Hi Kasper
>
> Kasper Daniel Hansen wrote:
>>
>> 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.
>>
>
> Here the output of this command...
>
> GMXUX-Ricardo-Rodriguez:~ rrodriguez$ sudo grep PATH * .*
> Password:
> .Rhistory:Sys.getenv("PATH")
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echoc$PATH
> .bash_history:$echo PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_history:echo $PATH
> .bash_profile.bak:export PATH=$PATH:$M2
> .viminfo:    export PATH=$PATH:$M2
> .viminfo:    export PATH=$PATH:$M2
> GMXUX-Ricardo-Rodriguez:~ rrodriguez$
>
> In fact I realized that I was using the wrong order of variables!  
> The right one is $M2:$PATH. But this has nothing to do with the  
> issue we are dealing with now.
>
> Could this .bash_profile.bak be the problem? I have left this file  
> there while trying to set some variables I need to work with Maven  
> in /etc/.bashrc.
>> Are you on a multi-user system? (Could your sys admin have played  
>> with site-settings?)
>
> I am using a brand new MacBook Pro laptop. I am the only user and  
> administrator.
>>
>> 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.
>
> I think years ago Mac OS X used tcsh as default shell. But today  
> bash is the default one. The "funny" thing is that sudo su  
> apparently switch to sh. I can not say much on this. Just that your  
> comment called my attention on this.
>>
>> 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.
>
> I got it! tar is part of the standard OS X distribution as ./usr/bin/ 
> tar
>
> Thanks for your help!
>
> Ricardo
>
>
> -- 
> Ricardo Rodríguez
> Your XEN ICT Team



More information about the R-SIG-Mac mailing list