I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code. I tend to work with a private library (Martin: I really do mean "library", not "package" :-) as the first element in the search path for packages so it would be helpful if I could learn how to set R_LIBS as well.
Setting environment variables, especially http_proxy and ftp_proxy
9 messages · Douglas Bates, stefano iacus, Hadley Wickham +3 more
Doug, does this help? http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh609.html Il giorno 05/apr/06, alle ore 20:35, Douglas Bates ha scritto:
I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code. I tend to work with a private library (Martin: I really do mean "library", not "package" :-) as the first element in the search path for packages so it would be helpful if I could learn how to set R_LIBS as well.
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
On 4/5/06, Douglas Bates <bates at stat.wisc.edu> wrote:
I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code.
I tend not to use the GUI for just this reason (and the fact it doesn't support my favourite bash completion stuff). It is trivial from the command line: HTTP_PROXY=.... R And you can set up an alias in ~/.profile if needed. Hadley
Doug,
On Apr 5, 2006, at 2:35 PM, Douglas Bates wrote:
I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code. I tend to work with a private library (Martin: I really do mean "library", not "package" :-) as the first element in the search path for packages so it would be helpful if I could learn how to set R_LIBS as well.
There are several ways to set environment variables for specific applications, but this is probably the most widely used one: http://developer.apple.com/qa/qa2001/qa1067.html Cheers, Simon
And I guess you can put it in .Renviron which contains environment variables being set when you run R. I am not sure however that the Rgui reads that file? I know there are ways to run R without the file being read - I think R CMD BATCH is one of them. /Kasper
On Apr 5, 2006, at 12:44 PM, Simon Urbanek wrote:
Doug, On Apr 5, 2006, at 2:35 PM, Douglas Bates wrote:
I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code. I tend to work with a private library (Martin: I really do mean "library", not "package" :-) as the first element in the search path for packages so it would be helpful if I could learn how to set R_LIBS as well.
There are several ways to set environment variables for specific applications, but this is probably the most widely used one: http://developer.apple.com/qa/qa2001/qa1067.html Cheers, Simon
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
1 day later
On Wed, 5 Apr 2006, Kasper Daniel Hansen wrote:
On Apr 5, 2006, at 12:44 PM, Simon Urbanek wrote:
On Apr 5, 2006, at 2:35 PM, Douglas Bates wrote:
I have installed the universal binary for R-2.2.1 on an Intel Mac that is behind a firewall. How do I ensure that the http_proxy environment variable is set when I start R? I understand that I must do this before the first time I use the internal network code. I tend to work with a private library (Martin: I really do mean "library", not "package" :-) as the first element in the search path for packages so it would be helpful if I could learn how to set R_LIBS as well.
There are several ways to set environment variables for specific applications, but this is probably the most widely used one: http://developer.apple.com/qa/qa2001/qa1067.html
And I guess you can put it in .Renviron which contains environment variables being set when you run R. I am not sure however that the Rgui reads that file? I know there are ways to run R without the file being read - I think R CMD BATCH is one of them.
The only problem I had with using .Renviron was that the setting for R_LIBS (which I set in that file) was not available to the command line invocations for running check and INSTALL. But even that is easily fixed as the format of .Renviron is the same as that of POSIX shell .profile. So in your .profile, import the desired portion of the R environment to your shell as well. This solution works on Mac OS X as well as any Un*x-based setup. --------------------- .Renviron -------------------------- ### ### .Renviron - R environment variables ### R_LIBS=~/Library/R/library R_NO_UNDERLINE=1 R_PAPERSIZE=letter STRICT_R_HEADERS=1 --------------------- .profile --------------------------- ### ### .profile - POSIX shell personal initialization ### ... whatever initialization code exists ... ## ## Setup R ## export $( grep R_LIBS .Renviron ) ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
On Apr 7, 2006, at 4:38 PM, Paul Roebuck wrote:
The only problem I had with using .Renviron was that the setting for R_LIBS (which I set in that file) was not available to the command line invocations for running check and INSTALL. But even that is easily fixed as the format of .Renviron is the same as that of POSIX shell .profile. So in your .profile, import the desired portion of the R environment to your shell as well. This solution works on Mac OS X as well as any Un*x-based setup.
Just a quick warning: this works only for the login shell, but not for anything else (including the R GUI, xterm, Emacs, etc.). This was Doug's point - .profile is useless for this. Even system profile is not run in xterm (surprise), Emacs or R-GUI, so you have to be very careful where you set the variables. The .MacOSX/environment.plist albeit less flexible has the advantage of applying to all applications launched by LS, so that's pretty much everywhere except for remote invocations. Of course, anything you start manually from the shell will inherits the environment, but not if 'open' is used. Cheers, Simon
On Fri, 7 Apr 2006, Simon Urbanek wrote:
On Apr 7, 2006, at 4:38 PM, Paul Roebuck wrote:
The only problem I had with using .Renviron was that the setting for R_LIBS (which I set in that file) was not available to the command line invocations for running check and INSTALL. But even that is easily fixed as the format of .Renviron is the same as that of POSIX shell .profile. So in your .profile, import the desired portion of the R environment to your shell as well. This solution works on Mac OS X as well as any Un*x-based setup.
Just a quick warning: this works only for the login shell, but not for anything else (including the R GUI, xterm, Emacs, etc.). This was Doug's point - .profile is useless for this. Even system profile is not run in xterm (surprise), Emacs or R-GUI, so you have to be very careful where you set the variables. The .MacOSX/environment.plist albeit less flexible has the advantage of applying to all applications launched by LS, so that's pretty much everywhere except for remote invocations. Of course, anything you start manually from the shell will inherits the environment, but not if 'open' is used.
True. I just run my "check" and "INSTALL" from Terminal.app so this has never caused me any issues. And on regular Un*x, xterm would have been launched by the shell. Since R.app reads .Renviron anyway, this method has been adequate for my multi-environment needs; if you use other Mac OS X applications, the Mac-specific environment.plist route is the way to go. Must admit to being surprised about 'open' though. Would have thought that (when run from Terminal.app) would have passed on the shell's environment. ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
Paul,
On Apr 7, 2006, at 6:19 PM, Paul Roebuck wrote:
True. I just run my "check" and "INSTALL" from Terminal.app so this has never caused me any issues. And on regular Un*x, xterm would have been launched by the shell.
No, that's not quite true - it's launched by the wm which in turn is launched by X11, so it is not started by the shell (login shell to be more precise) and thus never read .profile. However, depending on your X11 setup, you can tell xterm to process .profile, but the default setting for Apple X11 is not to (and it's default for some other unix systems, too).
Since R.app reads .Renviron anyway, this method has been adequate for my multi-environment needs;
If .Renviron is sufficient, that's fine, but as others were pointing out, R_LIBS for example must be set before that.
if you use other Mac OS X applications, the Mac-specific environment.plist route is the way to go. Must admit to being surprised about 'open' though. Would have thought that (when run from Terminal.app) would have passed on the shell's environment.
I must admit that you got me there :). In fact `open' actually passes the parent environment to the LS, although the documentation says the otherwise - interesting. Thanks for that one - this is definitely handy for testing things ... Cheers, Simon