[R-SIG-Mac] Setting environment variables, especially http_proxy and ftp_proxy

Paul Roebuck roebuck at mdanderson.org
Fri Apr 7 22:38:14 CEST 2006


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)



More information about the R-SIG-Mac mailing list