You Need Two Downloads (and Why)
Installing an R setup means installing two separate things:
- R itself - the language and interpreter, downloaded from CRAN (the Comprehensive R Archive Network) at cran.r-project.org. This is the part that actually runs your code.
- RStudio Desktop - the editor almost everyone writes R in, downloaded from posit.co. It's free and wraps R in a proper workspace: script editor, console, plot viewer, environment browser.
The order matters: R first, RStudio second. RStudio is only a shell around R - without R installed underneath it, it has nothing to run.
One more thing before you download anything: the code blocks on these docs pages are live, so you can start writing R immediately, install or no install:
If you just want to follow the next few lessons, that's genuinely enough. Come back to this page when you want R on your own machine.
Install R on Windows
- Go to cran.r-project.org and choose Download R for Windows.
- Click base (the link says "install R for the first time"), then download the installer - a file like
R-4.4.1-win.exe. - Run the installer. The defaults are fine at every step; click through and finish.
R installs to C:\Program Files\R\R-<version>\ and adds "R" to the Start menu. The Start-menu shortcut opens the bare R console - perfectly usable, but you'll want RStudio (below) for real work.
If you plan to build packages from source later you'll also want Rtools (linked from the same CRAN page), but skip it for now - beginners don't need it.
Install R on macOS
-
Go to cran.r-project.org and choose Download R for macOS.
-
Pick the right
.pkgfor your chip - this is the step people get wrong:- Apple silicon (M1, M2, M3, M4): the installer labeled arm64.
- Intel Macs: the x86_64 installer.
Not sure which you have? Apple menu → About This Mac. If the chip line says "Apple M-something", you're arm64.
-
Open the downloaded
.pkgand click through the installer.
You'll get R.app in Applications plus the R and Rscript command-line tools. If you use Homebrew, brew install --cask r works too, but the CRAN installer is the officially supported route.
Install R on Linux
R is in every major distribution's repositories:
# Debian / Ubuntu
sudo apt update
sudo apt install r-base
# Fedora
sudo dnf install R
One caveat: distro repositories sometimes lag several R versions behind. If you want the current release on Ubuntu, CRAN maintains its own apt repository - the instructions under "Download R for Linux" on the CRAN site walk through adding it. For learning purposes, the distro version is fine.
Verify the Install
Open a terminal (Command Prompt or PowerShell on Windows) and run:
R --version
You should see something like:
R version 4.4.1 (2024-06-14) -- "Race for Your Life"
If Windows says the command isn't recognized, R works fine but isn't on your PATH - the quickest fix is to just use RStudio, which finds R on its own. Two commands come with the install: R starts the interactive console, and Rscript runs script files - the distinction matters once you start running R scripts.
Install RStudio Desktop
- Go to posit.co/download/rstudio-desktop (RStudio's maker renamed itself Posit in 2022 - same product).
- Download the free RStudio Desktop installer for your OS and run it.
- Open RStudio. It auto-detects your R installation - if a console pane greets you with the R version banner and a
>prompt, everything is wired up.
Type this at the console prompt to celebrate:
paste("R", R.version.string, "is ready")
Why RStudio rather than the bare console? One window gives you a script editor with autocomplete, the console, every plot you make, your loaded data, and a package manager. The docs here never assume RStudio, but when a lesson mentions an IDE shortcut, RStudio is the one it means.
Your First Package (Optional Preview)
R's superpower is CRAN's package ecosystem. Installing a package is one line at the R console:
install.packages("ggplot2")
Don't run this yet if you don't need to - the lesson on packages covers what packages are, where they come from, and the difference between installing and loading. Just know the door is one command away.
What You Take Away
- R installs come in two parts: R itself from CRAN, then RStudio Desktop from posit.co - in that order.
- Windows: the "base" installer with default options. macOS: match the installer to your chip (arm64 for Apple silicon, x86_64 for Intel). Linux:
apt install r-baseordnf install R. - Verify with
R --versionin a terminal; RStudio finds R automatically either way. - You can run every example on these pages in the browser without installing anything.
Next up: the ways to actually run R code - the console, Rscript, source(), and RStudio.
Frequently Asked Questions
Where do I download R from?
From CRAN, the official home of R, at cran.r-project.org. Pick your operating system and download the latest release. Avoid third-party download sites - CRAN is free and always current.
Do I need both R and RStudio?
You need R - it's the language itself. RStudio is an editor that runs R and adds a console, script editor, plot pane, and package manager in one window. RStudio does not include R, so install R first, then RStudio. Nearly everyone writes R inside RStudio.
How do I check whether R installed correctly?
Open a terminal (Command Prompt or PowerShell on Windows) and run R --version. If it prints a version string like R version 4.4.1, the install worked. On Windows you may need to add R's bin folder to your PATH for the command to be found.
Which R installer do I pick on a Mac?
It depends on your chip. Macs with Apple silicon (M1/M2/M3/M4) need the arm64 .pkg; older Intel Macs need the x86_64 build. Check under the Apple menu → About This Mac if you're not sure. CRAN labels both installers clearly.