3  Installation

There are multiple ways to install R.

3.1 Install from binary distribution

CRAN mirrors are servers located in different places around the world containing R binaries and source code. Choose one near your physical location (for faster downloads), or select the cloud.r-project.org mirror, which automatically redirects your to a nearby server.

The R project maintains precompiled binary distributions of R for Linux, macOS, and Windows. Visit your CRAN mirror of choice and follow the instructions for your operating system.

3.2 Compile from source

If you are familiar with compiling software from source, you can download the R source code from any CRAN mirror instead. If you don’t know what this means, you may want to start with a precompiled binary (see above). If you want to learn more you can learn more on Wikipedia

3.3 Using rig

A newer method to install R is using rig. This lets you easily install R, and allows you to maintain installation of multiple versions of R, and makes it easy to switch between them.

To install rig, get the latest release from your operating system from rig releases.

Warning

rig may attempt to use sudo to install system dependencies. If you do not know what this means, it’s best to avoid using rig on systems you do not have administrative access to, e.g. shared servers / HPC clusters, etc. (UCSF users: don’t try this on Wynton!)

3.4 Using Homebrew

You can use Homebrew to install and maintain packages on your Mac, Linux, or Linux subsystem for Windows. To install R using the brew command line tool, run:

brew install r

3.5 Using conda/mamba

Another way to install R is using conda or mamba. This is not recommended for general R users, but may be useful for those who are already using conda/mamba for managing their software environment.

Using conda:

conda install r

Using mamba:

mamba install r