Install in this order: first R, then RStudio Desktop.

1. R

2. RStudio Desktop

Official download links from CRAN and Posit.

Update an existing R installation

Already have R? View the update guide

R updates are installed differently on each operating system. RStudio is a separate application and is not updated by the R commands below.

  1. Save your package list

    Run this in the R console before updating. It records only add-on packages, not the packages that come with R.

    ip <- installed.packages()
    packages_before <- rownames(ip)[is.na(ip[, "Priority"])]
    saveRDS(packages_before, "~/r-packages-before-update.rds")
  2. Check for and install a newer R version

    Windows — automatic option

    Open the standard R console as a user who can install software, then paste the complete command. It checks the latest available R version and opens the installer only when an update exists.

    if (!requireNamespace("installr", quietly = TRUE)) {
      install.packages("installr")
    }
    installr::updateR()

    Complete the installer prompts. When asked, choose to copy packages, keep the old packages, and update packages.

    macOS

    There is no equivalent universal R self-updater. Download the newest signed installer from the official CRAN macOS page, close RStudio, and run the installer.

    Linux

    Update R with your distribution's package manager and the appropriate CRAN repository. Follow the instructions for your distribution on the official CRAN Linux page.

  3. Tell RStudio which R version to use

    Windows: restart RStudio, then open Tools → Global Options → General → Basic → R Sessions. Select Change beside R version, choose the newest installation, confirm, and restart RStudio.

    macOS and Linux: close and reopen RStudio after updating R. It normally uses the system's current R installation.

    Verify the active installation in the RStudio console:

    R.version.string
    R.home()
    .libPaths()
  4. Restore and update packages

    On Windows, the updater can copy your packages automatically. Keep the old package library until you have confirmed that your projects work. For a manual installation or any packages still missing, run this in the new R version:

    packages_before <- readRDS("~/r-packages-before-update.rds")
    missing <- setdiff(packages_before, rownames(installed.packages()))
    if (length(missing)) install.packages(missing)
    update.packages(ask = FALSE, checkBuilt = TRUE)

    Important: do not manually copy R's base or recommended packages. Compiled packages may need to be reinstalled for the new R version. Bioconductor, GitHub, local, and renv project packages may require their original installation method.

Updating RStudio Desktop: you only need to update RStudio when the application displays a notification that a newer version is available. Follow the instructions shown by RStudio; updating R and updating RStudio are separate processes.