# INSTALL

0th

Percentile

Keywords
utilities
##### Usage
R CMD INSTALL [options] [-l lib] pkgs
##### Arguments
pkgs
a space-separated list with the path names of the packages to be installed. See Details.
lib
the path name of the Rlibrary tree to install to. Also accepted in the form --library=lib. Paths including spaces should be quoted, using the conventions for the shell in use.
options
a space-separated list of options through which in particular the process for building the help files can be controlled. Use R CMD INSTALL --help for the full current list of options.
##### Details

This will stop at the first error, so if you want all the pkgs to be tried, call this via a shell loop.

If used as R CMD INSTALL pkgs without explicitly specifying lib, packages are installed into the library tree rooted at the first directory in the library path which would be used by Rrun in the current environment.

To install into the library tree lib, use R CMD INSTALL -l lib pkgs. This prepends lib to the library path for duration of the install, so required packages in the installation directory will be found (and used in preference to those in other libraries). #ifdef windows

It is possible that environment variable TMPDIR will need to be set (although R CMD tries to set it suitably otherwise): use forward slashes and no spaces for the path to a writable directory. #endif

Both lib and the elements of pkgs may be absolute or relative path names of directories. pkgs may also contain names of package archive files: these are then extracted to a temporary directory. These are tarballs containing a single directory, optionally compressed by gzip, bzip2, xz or compress. #ifdef unix Finally, binary package archive files (as created by R CMD INSTALL --build) can be supplied. #endif #ifdef windows Finally, zipped binary packages (as created by R CMD INSTALL --build) can be supplied. #endif

Tarballs are by default unpackaged by the internal untar function: if needed an external tar command can be specified by the environment variable R_INSTALL_TAR: please ensure that it can handle the type of compression used on the tarball. (This is sometimes needed for tarballs containing invalid or unsupported sections, and can be faster on very large tarballs. Setting R_INSTALL_TAR to tar.exe has been needed to overcome permissions issues on some Windows systems.)

The package sources can be cleaned up prior to installation by or after by : cleaning is essential if the sources are to be used with more than one architecture or platform. #ifdef unix

Some package sources contain a configure script that can be passed arguments or variables via the option and , respectively, if necessary. The latter is useful in particular if libraries or header files needed for the package are in non-system directories. In this case, one can use the configure variables LIBS and CPPFLAGS to specify these locations (and set these via ), see section Configuration variables in R Installation and Administration for more information. (If these are used more than once on the command line they are concatenated.) The configure mechanism can be bypassed using the option . #endif

If the attempt to install the package fails, leftovers are removed. If the package was already installed, the old version is restored. This happens either if a command encounters an error or if the install is interrupted from the keyboard: after cleaning up the script terminates.

For details of the locking which is done, see the section Locking in the help for install.packages.

#ifdef windows

Option can be used to zip up the installed package for distribution. #endif #ifdef unix

Option can be used to tar up the installed package for distribution as a binary package (as used on OS X). This is done by utils::tar unless environment variable R_INSTALL_TAR is set. #endif

By default a package is installed with static HTML help pages if and only if Rwas: use options and to override this.

Packages are not by default installed keeping the source formatting (see the keep.source argument to source): this can be enabled by the option or by setting environment variable R_KEEP_PKG_SOURCE to yes.

Use R CMD INSTALL --help for concise usage information, including all the available options.

##### Note

The options do not have to precede pkgs on the command line, although it will be more legible if they do. All the options are processed before any packages, and where options have conflicting effects the last one will win. #ifdef unix

Some parts of the operation of INSTALL depend on the Rtemporary directory (see tempdir, usually under /tmp) having both write and execution access to the account running R. This is usually the case, but if /tmp has been mounted as noexec, environment variable TMPDIR may need to be set to a directory from which execution is allowed. #endif

##### Sub-architectures

An Rinstallation can support more than one sub-architecture: currently this is most commonly used for 32- and 64-bit builds on Windows. For such installations, the default behaviour is to try to install source packages for all installed sub-architectures unless the package has a configure script or a src/Makefile (or src/Makefile.win on Windows), when only compiled code for the sub-architecture running R CMD INSTALL is installed.

To install a source package with compiled code only for the sub-architecture used by R CMD INSTALL, use . To install just the compiled code for another sub-architecture, use .

There are two ways to install for all available sub-architectures. If the configure script is known to work for both Windows architectures, use flag (and packages can specify this via a Biarch field in their DESCRIPTION files). Second, a single tarball can be installed with R CMD INSTALL --merge-multiarch mypkg_version.tar.gz

REMOVE; .libPaths for information on using several library trees; install.packages for R-level installation of packages; update.packages for automatic update of packages using the Internet or a local repository.

The section on Add-on packages in R Installation and Administration and the chapter on Creating R packages in Writing RExtensions #ifdef windows (on the Help menu in RGui), #endif RShowDoc and the doc/manual subdirectory of the Rsource tree).

##### Aliases
• INSTALL
• R_INSTALL_TAR
Documentation reproduced from package utils, version 3.3, License: Part of R 3.3

### Community examples

Looks like there are no examples yet.