1 Obtaining R
Sources, binaries and documentation for R can be obtained via CRAN, the “Comprehensive R Archive Network” whose current members are listed at https://CRAN.R-project.org/mirrors.html.
1.1 Getting and unpacking the sources
The simplest way is to download the most recent R-x.y.z.tar.gz
file, and unpack it with
tar -xf R-x.y.z.tar.gz
on systems that have a suitable1 tar
installed. On other systems you need to have the gzip
program installed, when you can use
1 e.g. GNU tar
version 1.15 or later, or that from the libarchive
(as used on macOS) or ‘Heirloom Toolchest’ distributions.
gzip -dc R-x.y.z.tar.gz | tar -xf -
The pathname of the directory into which the sources are unpacked should not contain spaces, as most make
programs (and specifically GNU make
) do not expect spaces.
If you want the build to be usable by a group of users, set umask
before unpacking so that the files will be readable by the target group (e.g., umask 022
to be usable by all users). Keep this setting of umask
whilst building and installing.
If you use a fairly recent GNU version of tar
and do this as a root account (which on Windows includes accounts with administrator privileges) you may see many warnings about changing ownership. In which case you can use
tar --no-same-owner -xf R-x.y.z.tar.gz
and perhaps also include the option --no-same-permissions
. (These options can also be set in the TAR_OPTIONS
environment variable: if more than one option is included they should be separated by spaces.)
1.2 Getting patched and development versions
A patched version of the current release, r-patched
, and the current development version, r-devel
, are available as daily tarballs and via access to the R Subversion repository. (For the two weeks prior to the release of a minor (4.x.0) version, r-patched
tarballs may refer to beta/release candidates of the upcoming release, the patched version of the current release being available via Subversion.)
The tarballs are available from https://cran.r-project.org/src/base-prerelease/. Download R-patched.tar.gz
or R-devel.tar.gz
(or the .tar.bz2
versions) and unpack as described in the previous section. They are built in exactly the same way and on the same platform as distributions of R releases. Notice, that you probably want to use the CRAN master site for this, due to propagation delays. An alternative source of daily snapshots is maintained at https://stat.ethz.ch/R/daily/.
1.2.1 Using Subversion and rsync
Sources are also available via https://svn.R-project.org/R/, the R Subversion repository. If you have a Subversion client (see https://subversion.apache.org/), you can check out and update the current r-devel
from https://svn.r-project.org/R/trunk/ and the current r-patched
from https://svn.r-project.org/R/branches/R-x-y-branch/
(where x
and y
are the major and minor number of the current released version of R). E.g., use
://svn.r-project.org/R/trunk/ path svn checkout https
to check out r-devel
into directory path
(which will be created if necessary). The alpha, beta and RC versions of an upcoming x.y.0
release are available from https://svn.r-project.org/R/branches/R-x-y-branch/
in the four-week period prior to the release.
Note that https:
is required2, and that the SSL certificate for the Subversion server of the R project should be recognized as from a trusted source.
2 for some Subversion clients http:
may appear to work, but requires continual redirection.
Note that retrieving the sources by e.g. wget -r
or svn export
from that URL will not work (and will give a error early in the make
process): the Subversion information is needed to build R.
The Subversion repository does not contain the current sources for the recommended packages, which can be obtained by rsync
or downloaded from CRAN. To use rsync
to install the appropriate sources for the recommended packages, run ./tools/rsync-recommended
from the top-level directory of the R sources.
If downloading manually from CRAN, do ensure that you have the correct versions of the recommended packages: if the number in the file VERSION
is x.y.z
you need to download the contents of https://CRAN.R-project.org/src/contrib/dir
, where dir
is x.y.z/Recommended
for r-devel or x.y-patched/Recommended
for r-patched, respectively, to directory src/library/Recommended
in the sources you have unpacked. After downloading manually you need to execute tools/link-recommended
from the top level of the sources to make the requisite links in src/library/Recommended
. A suitable incantation from the top level of the R sources using wget
might be (for the correct value of dir
)
-r -l1 --no-parent -A\*.gz -nd -P src/library/Recommended \
wget ://CRAN.R-project.org/src/contrib/dir
https/tools/link-recommended .
Footnotes