How to Install R and RStudio on Windows, Mac and Linux
By Dr. Zubair Khalid, DVM, MS, PhD ·

R is a statistical programming language widely used in the life sciences to clean data, run models and produce figures that other people can reproduce. RStudio is the integrated development environment (IDE) that sits on top of R and gives you a console, a script editor, a file browser and a plot pane in one window. Posit describes RStudio as "an integrated development environment (IDE) designed to support multiple languages, including both R and Python" [5]. You need both programs, and you need them in the right order.
By the end of this guide you will have R and RStudio running on your own machine, you will know how to verify the install with a short statistical test, and you will understand what to do when a new version arrives. The instructions cover Windows, macOS, Ubuntu and Chromebooks, with notes on where the platforms diverge.
Quick Answer
- Download R from CRAN at https://cloud.r-project.org, choosing the build for your operating system [6].
- Install R first, then download RStudio Desktop from https://posit.co/download/rstudio-desktop/ and install it second [6].
- On Windows, use the CRAN
basedirectory, which is the one to use "to install R for the first time" [1]. - On macOS, pick the arm64 installer for Apple silicon or the x86_64 installer for Intel [3].
- On Ubuntu, add the CRAN repository and install
r-basewith apt [4]. - On a Chromebook, the safer route is Posit Cloud, which runs RStudio in a browser with no local installation [9]. No official Posit page documents RStudio on ChromeOS.
Step 1: Understand What You Are Installing
R and RStudio are separate programs with separate installers. R does the computation. RStudio is a front end that calls R behind the scenes. If you install RStudio without R, the IDE will open and then complain that it cannot find a valid R installation. The setup order in R for Data Science 2e is explicit: download R from CRAN, then download RStudio from Posit [6].
Both are free for the open source desktop versions. RStudio Desktop is AGPL licensed, while Posit Workbench is the commercial product that removes the AGPL restrictions [5]. For coursework and academic research, the open source desktop build is what you want.
Versions move quickly. As of October 2026, the current R release is R 4.6.1 "Happy Hop" (released 2026-06-24) and the current RStudio Desktop is 2026.09.0 build 174 (released 2026-09-22) [3][5]. Check the download pages before you start, because R 4.7.0 is expected around April 2027 and will need a fresh package library.
Step 2: Install R on Windows
Go to https://cloud.r-project.org and click the Windows link, then follow the link to the base directory. CRAN labels that directory as the one to use "to install R for the first time" [1]. The current installer is R-4.6.1-win.exe, about 88 MB, 64-bit [1].
Run the installer and accept the defaults. Administrator rights help because they let the installer write into Program Files and set registry entries, but they are not required. Non-admin users can install R in their own file space, and since R 4.2.0 a non-admin Windows install defaults to the user's Program Files folder, typically C:\Users\username\AppData\Local\Programs [7].
One system note: the R 4.6.1 build requires UCRT, which is part of Windows since Windows 10 and Windows Server 2016. On older systems you must install UCRT manually [1].
Step 3: Install R on macOS
The macOS page on CRAN offers two separate installers for R 4.6.1, and you must pick the one that matches your Mac's chip [3]:
R-4.6.1-arm64.pkg(about 101 MB) for Apple silicon Macs (M1 and later) running macOS 14 Sonoma or higher.R-4.6.1-x86_64.pkg(about 104 MB) for Intel Macs running macOS 11 Big Sur or higher.
Open the .pkg file and follow the installer. The package includes the R framework, the R.app GUI 1.83, Tcl/Tk 8.6.12, and optional X11 libraries and Texinfo 7.3 components available through a custom install [3].
XQuartz 2.8.5 or later is needed only if you use X11 or tcltk functionality. If you do, remember that XQuartz must be reinstalled after upgrading to a new macOS major version [3]. Most users analyzing data in RStudio never touch X11.
Step 4: Install R on Ubuntu and Other Linux Distributions
CRAN documents a short sequence of commands for Ubuntu. Run them in order [4]:
sudo apt update -qq
sudo apt install --no-install-recommends software-properties-common dirmngr
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt install --no-install-recommends r-base
The first command refreshes the package index and the second installs the tools needed to add a third-party repository. The third imports CRAN's signing key so apt can verify the packages. The fourth registers the CRAN repository for your Ubuntu release, and the fifth installs R itself.
CRAN builds R 4.6 packages for the LTS releases 26.04 (resolute), 24.04 (noble) and 22.04 (jammy), for both amd64 and arm64 [4]. If you want CRAN packages as prebuilt binaries through apt, CRAN points to the r2u project. The older c2d4u project is on hiatus and no longer updating packages, so do not build a workflow around it [4].
Step 5: Install RStudio Desktop
With R in place, go to https://posit.co/download/rstudio-desktop/ and download the installer for your platform [6]. Posit lists these direct installers for version 2026.09.0-174 [5]:
- Windows 11:
RStudio-2026.09.0-174.exe(a.zipis also available) - macOS 14+:
RStudio-2026.09.0-174.dmg - Ubuntu/Debian:
rstudio-2026.09.0-174-amd64.deb - RHEL/Fedora:
rstudio-2026.09.0-174-x86_64.rpm
Posit also lists builds for Ubuntu 22/24/26, Debian 13 and RHEL 9/10 [5]. On Ubuntu or Debian, install the .deb after R is already installed [5]:
sudo apt install ./rstudio-2026.09.0-174-amd64.deb
RStudio runs on the desktop (Windows 11, macOS 14+ and Linux) or in a browser connected to RStudio Server or Posit Workbench [5]. For a single laptop, the desktop build is the right choice.
Step 6: Optional, Install Rtools on Windows
Rtools is the set of "toolchains for building R and R packages from source on Windows" [2]. You only need it when you install R packages from source that contain C, C++, or Fortran code, or when you build R itself. Ordinary binary CRAN packages install without it, so many users can skip this step entirely [2].
If you do compile packages, install Rtools45, which is the current Rtools and is used for R 4.5 and later, including R 4.6.x and the development version that will become R 4.7.0. The recommended install location is C:\rtools45 [2]. Match Rtools to your R version: for R 4.6.x and 4.5.x use Rtools45, and do not install an older Rtools with a current R [2]. The installers are rtools45-6768-6492.exe for 64-bit Intel/AMD Windows and rtools45-aarch64-6768-6492.exe for ARM Windows [2].
Step 7: Chromebooks and Cloud Alternatives
Google documents turning on Linux at Settings > About ChromeOS > Developers > "Linux development environment" > Set up. Setup can take 10 minutes or more and opens a terminal with a Debian environment [8]. On a work or school managed Chromebook, Linux may be blocked, and Google says to contact the administrator [8].
No official Posit page documents RStudio on ChromeOS. Installing R inside the Debian container with apt and then the RStudio .deb is possible, but Posit does not document it, and ARM Chromebooks would need an arm64 build while Posit's listed .deb is amd64. The safer option is Posit Cloud, which runs RStudio in a web browser with no local installation and has a free tier described as "a fully functional environment, available to anyone, with no expiration date" [9]. Paid plans are listed at Basic $25/month, Standard $75/month, Instructor $15/month and Student $5/month, all month-to-month [9].
Worked Example
Open RStudio and type these lines in the Console. First, confirm which R you are running:
R.version.string
If R 4.6.1 is installed, this prints a line in the form "R version 4.6.1 (2026-06-24) -- ...". Next, get a full picture of your session:
sessionInfo()
That prints the R version, platform, operating system, locale and attached packages. Recording this output is good practice for reproducibility, since Sandve et al. (2013) recommend archiving the exact versions of all external programs used [10].
Now check that R computes correctly. This example uses two small vectors of measurements:
a <- c(5.1, 4.8, 5.6, 5.3, 4.9)
b <- c(4.2, 4.5, 4.0, 4.6, 4.3)
mean(a)
mean(b)
t.test(a, b)
mean(a) gives 5.14 and mean(b) gives 4.32. The t.test(a, b) call runs a Welch two-sample test, which is R's default, and returns t = 4.5839, df = 7.3892, p-value = 0.002202, with a 95 percent confidence interval for the difference of 0.4015 to 1.2385. Those numbers were cross-checked with scipy.stats.ttest_ind(equal_var=False) in Python. You can verify the arithmetic yourself with the T-Test Calculator.
What does this result mean? Under the null hypothesis that the two groups have the same mean, a difference at least this large would appear about 0.2 percent of the time. It does not tell you the effect is biologically important, and it does not tell you the data are normally distributed. It tells you the install works and R's statistics engine is producing the expected output.
Windows users who installed Rtools45 can confirm the toolchain is visible:
Sys.which("make")
This should return a path inside C:\rtools45.
Common Mistakes and How to Fix Them
- RStudio opens but says it cannot find R. R is not installed yet, or the install did not finish. Install R from CRAN, then restart RStudio [6].
- The wrong macOS installer. Installing the x86_64 build on an M-series Mac, or the arm64 build on an Intel Mac, produces errors or poor performance. Check your chip under the Apple menu, then match the installer [3].
- Rtools version mismatch. Using an older Rtools with R 4.6.x is not supported for compiling packages. Use Rtools45 for R 4.5 and later [2].
- Packages vanish after an R upgrade. The personal package library is version specific. If the major.minor version is unchanged (4.6.0 to 4.6.1), running
update.packages(checkBuilt=TRUE, ask=FALSE)is enough. After a minor-version jump (4.5 to 4.6) the packages must be reinstalled into the new library, and the FAQ advises against copying packages from the old library [7]. install.packages()fails on Windows with a compilation error. You are trying to build a package from source without Rtools. Install Rtools45, or find a binary version of the package [2].- Linux apt installs an old R. You skipped the CRAN repository step, so apt pulled the distribution's version. Add the CRAN repository and reinstall
r-base[4]. - Chromebook Linux setup fails. Managed devices may block Linux entirely. Contact your administrator, or use Posit Cloud instead [8][9].
Limitations
R and RStudio are versioned software, and the numbers in this article were current on 2026-10-01. R 4.6.1 and RStudio 2026.09.0-174 will be superseded, and R 4.7.0 is expected around April 2027 with a new package library requirement. Always check the download pages before installing.
The Posit download URL currently redirects to the documentation site that hosts the download links, so a bookmark to the old page may land you somewhere unexpected [5]. The cloud mirror at https://cloud.r-project.org is the address to use for R downloads, even though some mirrors serve identical files under different hostnames [6].
Platform support has hard edges. RStudio Desktop requires Windows 11, macOS 14+ or Linux [5]. The macOS arm64 build needs macOS 14 Sonoma or higher, and the Intel build needs macOS 11 Big Sur or higher [3]. Windows systems older than Windows 10 need UCRT installed manually [1].
Posit Cloud removes the install problem but introduces its own constraints. The free tier is described as fully functional with no expiration date, but specific compute hour, project count and RAM limits for the free plan are not published in a form that can be quoted here. Check the plans page for current details [9].
Finally, installing R does not make your analysis reproducible. Version control, archived package versions and recorded session information are separate practices [10].
Frequently Asked Questions
How do I install RStudio on Windows?
Download R from CRAN first, then get the Windows installer from the Posit download page and run it. The current file is RStudio-2026.09.0-174.exe for Windows 11 [5]. Accept the defaults and launch RStudio once R is in place.
How do I install RStudio on Mac?
Install R using the arm64 or x86_64 .pkg that matches your Mac's chip, then download RStudio-2026.09.0-174.dmg from Posit and drag it to Applications [3][5]. If you use X11 or tcltk features, install XQuartz 2.8.5 or later as well [3].
How do I install RStudio on Ubuntu?
Add the CRAN repository and install r-base with apt, then download the .deb from Posit and install it [4][5]. Posit lists rstudio-2026.09.0-174-amd64.deb for Ubuntu and Debian systems [5].
How do I install RStudio on a Chromebook?
Turn on the Linux development environment in ChromeOS settings, which gives you a Debian container [8]. Installing R and RStudio inside it is possible but not officially documented by Posit, and ARM Chromebooks would need an arm64 build. Posit Cloud in a browser is the safer route [9].
How do I update RStudio?
Download the newer installer from Posit and install it over the existing version. RStudio updates a couple of times a year and will let you know when a new version is out, and R for Data Science recommends upgrading regularly [6]. Your projects and scripts are unaffected by the update.
References
- CRAN: Download R-4.6.1 for Windows
- CRAN: Rtools45 for Windows
- CRAN: R for macOS
- CRAN: Ubuntu packages for R
- Posit: RStudio IDE User Guide (downloads)
- Wickham, Cetinkaya-Rundel, Grolemund. R for Data Science (2e), Introduction: Prerequisites
- CRAN: R for Windows FAQ
- Google Chromebook Help: Set up Linux on your Chromebook
- Posit Cloud product page
- Sandve GK, et al. Ten Simple Rules for Reproducible Computational Research. PLoS Comput Biol. 2013;9(10):e1003285
- Wickham H, et al. Welcome to the Tidyverse. J Open Source Softw. 2019;4(43):1686
Related Articles
- Reproducible Research in R: A Practical Guide for Life Scientists
- Python vs. R for Computational Biology
- R vs. SPSS vs. Python for Biostatistical Analysis
- Computational Notebooks for Reproducible Research: Best Practices
- How to Install R Packages from CRAN, Bioconductor and GitHub (and Fix Install Errors)
- RStudio for Beginners: Projects, Working Directory and Importing CSV and Excel Files