[R-SIG-Mac] system() from R.app

stefano iacus stefano.iacus at unimi.it
Thu Nov 30 10:15:21 CET 2006

yes, R.app does not have the same env vars sets of the shell. This,  
indeed, applies to all GUI app under OS X. It is possible to set env  
vars at OS X level. There is a plist file somewhere. I don't remember  
the details because I never use it.

In your case latex is not the the current path used by R.app

You can check it using
path <- Sys.getenv("PATH")

in my case latex is under /usr/local/teTeX/bin/powerpc-apple-darwin- 
current (a "which latex" or env in the shell will tell) so

new.path <- paste(path,":/usr/local/teTeX/bin/powerpc-apple-darwin- 
current", sep="")

and add latex path using

Sys.putenv("PATH"= new.path)
now latex should work.


On 30/nov/06, at 17:58, nicola sartori wrote:

> Dear all,
> I have a question on the use of system(command) from R.app:
> if I try, for instance, to do:
> system("latex foo.tex")
> I get the following output in the console:
> /bin/sh: line 1: latex: command not found
> While if I do the same thing running R from the terminal (or xterm
> under X11) it works just fine.
> I guess the reason is that, when in the terminal, the path is set by
> my shell init file (which, incidentally, is bash) while this doesn't
> happen when in R.app.
> By the way, running latex is not a big issue: I can get the right
> path from options(), but for other commands the problem will still be
> there
> Is there a workaround for this?
> Thanks in advance for any help.
> Best,
> Nicola
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

More information about the R-SIG-Mac mailing list