What R is and where to get it

R is a free programming language built for statistics and data analysis. You download it from the Comprehensive R Archive Network (CRAN), which is the official distribution site run by the R Foundation. The software runs on Windows, Mac, and Linux.

The process takes about five minutes: you visit the CRAN website, choose your operating system, download one file, and run the installer. After that, R sits on your computer ready to use. Most people also install RStudio afterward — a separate program that makes R easier to work with — but R itself is what you need first.

Key Takeaways

  • R is free and comes from CRAN (cran.r-project.org), not from app stores or other download sites.
  • Windows users download from the "base" folder; Mac users need to pick the right version for their chip type (Intel or Apple Silicon).
  • The installer runs like any other program — you click through the setup screens and choose where to save it on your computer.
  • After installation, you can open R directly, but most people install RStudio as a second step to get a friendlier interface.

Downloading R on Windows

Go to cran.r-project.org in your web browser. On the left side of the page, click "Download R for Windows". On the next page, click the link that says "base" — this is the main R installation, not add-on packages.

Click the large blue button labeled "Download R X.X.X for Windows" (the X's are version numbers that change over time). This downloads a single .exe file to your computer, usually to your Downloads folder. The file is about 80 to 100 megabytes.

Open the file you just downloaded. Windows may ask if you want to allow this program to make changes to your device — click "Yes". The R installer opens and walks you through setup screens. You can accept all the default choices: the language, the installation location, and the startup options. Click "Next" through each screen, then "Finish" at the end. R is now installed.

Downloading R on Mac

Go to cran.r-project.org in your web browser. On the left side, click "Download R for macOS". The next page shows different download links depending on your Mac's processor chip.

If you have an Apple Silicon Mac (M1, M2, M3, or newer chip), download the file labeled "R-X.X.X-arm64.pkg". If you have an older Intel-based Mac, download "R-X.X.X-x86_64.pkg". You can check which chip your Mac has by clicking the Apple menu, selecting "About This Mac", and looking at the "Chip" line.

Open the .pkg file you downloaded. The Mac installer opens and walks you through the setup. Accept the default location (usually /Library/Frameworks/R.framework) and click through to finish. R is now installed on your Mac.

Installing RStudio after R

R itself works fine, but most people install RStudio next because it provides a cleaner interface with separate panels for your code, your results, and your files. RStudio is also free and runs on Windows, Mac, and Linux.

Go to posit.co/download/rstudio-desktop in your web browser. The page detects your operating system and shows the right download button. Click it. The file downloads to your computer — it is about 200 megabytes.

Open the installer file. On Windows, click through the setup screens as you did with R. On Mac, drag the RStudio icon into the Applications folder. After installation, you can open RStudio from your Applications folder (Mac) or Start menu (Windows). RStudio will find R automatically if you installed it in the default location.

Checking that R installed correctly

On Windows, open the Start menu and type "R" — you should see "R x64 X.X.X" or "R i386 X.X.X" appear. Click it to open R. On Mac, open Applications, then Utilities, then double-click R.app.

A window opens with a prompt that looks like this: >. Type the number 2+2 and press Enter. R should print [1] 4 below your command. If you see that, R is working. Type q() and press Enter to close R.

If you installed RStudio, open it instead. You should see four panels: code on the upper left, console on the lower left, environment on the upper right, and files on the lower right. Type 2+2 in the console (lower left) and press Enter. If you see [1] 4, RStudio is working too.

Troubleshooting common installation problems

If the R installer will not run on Windows, your antivirus software may be blocking it. Temporarily disable your antivirus, run the installer, then turn it back on. If you see an error about missing dependencies on Mac, make sure you have Xcode Command Line Tools installed — open Terminal and type xcode-select --install, then try the R installer again.

If RStudio opens but does not find R, go to Tools > Global Options > General in RStudio's menu. Under "R version", click "Change" and browse to where you installed R. On Windows, this is usually C:\Program Files\R\R-X.X.X. On Mac, it is usually /Library/Frameworks/R.framework/Resources.

If you downloaded the wrong version of R for Mac (Intel instead of Apple Silicon or vice versa), the installer will still run but R may run slowly or not work at all. Uninstall it by dragging /Library/Frameworks/R.framework to the Trash, then download and install the correct version.

What to do after installation

R and RStudio are now ready to use, but you may want to install additional packages depending on what you plan to do. Packages are add-ons that extend R's built-in functions. You install them from within R or RStudio using the install.packages() command, not by downloading files from the web.

If you are new to R, the RStudio website has free tutorials and documentation. The official R website (r-project.org) also has manuals and guides. Both are written for people learning statistics and programming, not just for experts.

Frequently Asked Questions

Do I need to install both R and RStudio?

You need R itself to run any code. RStudio is optional but makes working with R much easier because it organizes your code, results, and files in one window. Most people install both.

Can I install R on a Chromebook or tablet?

R does not run natively on Chromebooks or tablets. You can access R remotely through a web browser using services like RStudio Cloud or Posit Cloud, but you cannot install the desktop version on those devices.

Is it safe to download R from cran.r-project.org?

Yes. CRAN is the official R distribution site run by the R Foundation. Only download R from cran.r-project.org or one of its official mirrors listed on that site. Do not download R from other websites.

How much disk space does R need?

R itself takes about 100 to 200 megabytes of disk space. RStudio takes another 200 to 300 megabytes. Both are small compared to most modern computers.

Can I have multiple versions of R installed at the same time?

Yes, you can install different versions of R on the same computer. However, RStudio can only point to one version at a time. If you need to switch between versions, you change the R version in RStudio's settings.