How to update R using RStudio on Windows or macOS?

I’m trying to figure out how to update R through RStudio. I’m currently using an older version of R, and some packages I need require a newer version. Is there a way to update R from within RStudio itself, or do I need to download it separately from CRAN?

Also, after updating R, do I need to manually reinstall all my existing packages, or is there a recommended way to migrate them? Any step-by-step guidance would be appreciated!

Been using R for over a decade now, and I’ve had to explain this quite a few times…

Honestly, how to update R trips up a lot of people because RStudio doesn’t actually update R itself. It just rides on whatever version of R is installed on your system. On Windows, I usually go to CRAN’s R for Windows page and grab the latest .exe installer. It installs like any other Windows app—and the cool part is you can even keep the old version.

After that, I fire up RStudio, and 9 out of 10 times it picks up the new version on its own. If not, just hop into Tools > Global Options > General and set the R version manually.

If you want to carry your packages over, check out the installr package. Just run:

install.packages("installr")
installr::updateR()

It’ll walk you through the update and even offer to migrate your packages. Pretty handy

Jumping in here, I’m on macOS and went through this just last week.

Adding to what Tom said, the process for how to update R on macOS is similar but slightly more manual. Head over to CRAN’s macOS section, download the latest .pkg file, and run it. It installs cleanly over the previous version, no need to uninstall anything.

RStudio generally auto-detects the new version, just like it does on Windows.

What helped me a lot was saving my package list before the update. Here’s what I do:

pkg_list <- installed.packages()[, "Package"]
save(pkg_list, file = "packages.RData")

Then, after the new R is installed, just restore:

load("packages.RData")
install.packages(pkg_list)

It’s not plug-and-play, but it saves you from the “which packages did I have again?” moment.

Good points from both of you. I’ve been working on automating my R setups for teams, so here’s a more structured take.

When folks ask me how to update R, I always say: yes, downloading from CRAN manually is still the way to go, RStudio doesn’t handle core updates.

But what makes the whole process less painful for me now is the {pak} package. After installing the new R version, I open RStudio and run:

install.packages("pak")
pak::pak(c("tidyverse", "data.table", "whatever-you-use"))

It’s blazing fast with dependencies and makes reinstallation feel like a breeze.

I also recommend using {renv} if you’re working on projects. Snapshot your package environment before the update. Then restore it after. Super clean and reproducible.

So, yeah, updating R isn’t one-click simple yet, but with a mix of installr, package saving, or pak/renv, it’s very manageable.