How to Uninstall R and RStudio on Ubuntu

How to Uninstall R and RStudio on Ubuntu

R is a popular programming language and environment for statistical computing and graphics. RStudio, on the other hand, is an integrated development environment (IDE) for R, making it easier for users to develop in the R language. However, there might be instances where you need to uninstall R and RStudio from your Ubuntu system.

Whether you’re looking to free up space, encountering compatibility issues, or simply no longer need them, this guide will walk you through the process step-by-step.

Let’s get started.

Step 1: Uninstall R

Open the terminal and remove the R packages:

sudo apt-get --purge remove r-base r-base-dev r-recommended r-cran-*

Now, remove any additional libraries or dependencies that were installed with R but are no longer used:

sudo apt-get autoremove

Update the package list:

sudo apt-get update

Step 2: Uninstall RStudio

In the terminal, type the following command to remove RStudio:

sudo apt-get remove rstudio

To ensure all associated files and configurations are removed, purge RStudio:

sudo apt-get purge rstudio

Step 3: Remove R Repositories from Sources List

Navigate to the sources list directory:

cd /etc/apt/sources.list.d

List all the source files:


If you see any R-related repositories, such as “”, remove them using:

sudo rm

Step 4: Update Your System

After uninstalling R and RStudio, it’s a good practice to update your system’s package database:

sudo apt-get update

Commands Mentioned

  • sudo apt-get –purge remove r-base r-base-dev r-recommended r-cran-* – Removes R and its associated packages.
  • sudo apt-get autoremove – Removes unused libraries and dependencies.
  • sudo apt-get remove rstudio – Removes RStudio.
  • sudo apt-get purge rstudio – Purges RStudio, removing configurations and associated files.
See also  How to Uninstall Ajenti Control Panel on Ubuntu


  1. Why might I need to uninstall R and RStudio?

    There could be several reasons, such as needing to free up disk space, encountering software conflicts, or intending to install a different version of R and RStudio.

  2. Is it necessary to remove R repositories from the sources list?

    While not strictly necessary, it’s a good practice to remove unused repositories to keep your sources list clean and avoid potential conflicts in the future.

  3. Can I reinstall R and RStudio after uninstalling?

    Yes, you can reinstall R and RStudio anytime after uninstalling. Simply follow the installation procedures for each software.

  4. Will uninstalling R and RStudio remove my scripts and data?

    No, uninstalling the software will not remove your personal scripts and data. However, it’s always a good idea to back up important files before making major changes.

  5. Are there any risks associated with uninstalling R and RStudio?

    The uninstallation process is generally safe. However, always ensure you’re removing the correct packages and not accidentally uninstalling essential system packages.

See also  How to Install and Configure sudo on Ubuntu


Uninstalling R and RStudio from your Ubuntu system is a straightforward process when you follow the steps outlined in this guide. Whether you’re looking to declutter your system, resolve software conflicts, or prepare for a fresh installation, this tutorial provides a clear path to achieving your goal.

Remember, before making any significant changes to your system, always back up essential data to prevent any potential loss.

If you’re working on web projects or hosting applications, consider exploring the different hosting solutions available. From dedicated servers to VPS hosting, there’s a solution tailored to every need.


1 Comment

  • Avatar Jaakko Koskenniemi says:

    Thank you! This literally saved me after a custom shell script wrecked my R settings beyond repair. Lost 2-3 hours of working time before finding this script.

Leave a Reply

Your email address will not be published. Required fields are marked *