Skip to content

Installing RStudio Dependencies

Gary edited this page Aug 8, 2022 · 82 revisions

Using Vagrant

This page is intended to help you configure your own machine for RStudio development. If you'd prefer an isolated development environment in a preconfigured virtual machine, you can use our Vagrant configuration script to create one (see RStudio Development for details).

Windows Bootstrapper

On a clean Windows-10 64-bit system, you can bootstrap RStudio development by following the instructions here. Otherwise, configure manually per the following instructions.

Installing R

On all platforms you need to install a version of R to target development against; you should install R before running any dependency installation scripts in RStudio.

RStudio itself is compatible with R version 3.0.1 or later, but version 3.1 or greater is recommended for development installations. The following are links to the installers for current, older, and development versions of R for all supported platforms.

Linux (Source)

A version of R exists in the package repository for most major versions of Linux, but it's usually very outdated, so we recommend installing R binaries from CRAN instead.

Ubuntu Quickstart

If you're building an Ubuntu dev box, here's the tl;dr for getting R installed on Trusty (Ubuntu 14):

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
echo 'deb http://cran.rstudio.com/bin/linux/ubuntu trusty/' >> /etc/apt/sources.list
apt-get update
apt-get install r-base

For Ubuntu 18:

apt install apt-transport-https software-properties-common
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
apt update
apt install r-base

R for macOS

R for Windows

Make sure to install R to C:\R, not C:\Program Files\R as is the default, since RStudio's build process needs to write additional symbol information into R's installation directory, and will not have permission to write to Program Files.

Additional Dependencies (Linux)

gcc version

It is recommended that you build RStudio with GCC 4.8 or above. For Pro builds, this is required.

Also, on some platforms you must manually select and install an OpenJDK-8 or 11. Some of the dependency scripts mentioned below have been updated to install this for you, others have not. Please check the script to see if there is an openjdk reference in it.

Install Linux Dependencies

On Linux all dependencies for RStudio Server can be installed installed using the scripts in:

rstudio/
  dependencies/
    linux/

There is a separate script for systems with debian, yum, or zypper based package management. For example, to install dependencies for debian systems:

./install-dependencies-debian

Qt SDK for Linux (RStudio Spotted-Wakerobin or older)

If you are building against main, then the Qt SDK is no longer required. Starting with the Elsbeth-Geranium release (late 2022) we have moved RStudio Desktop off of Qt and onto Electron.

To build an older branch of RStudio Desktop, the Qt 5.12.10 SDK must be installed from https://qt.io.

5.12.10 won't show up automatically when installing via the Qt online installer. To reveal it, click the "Archive" checkbox on the "Select Components" screen, then the Filter button. The list of available versions will expand to include all versions.

You should download and install this to the default location on your system (~/Qt).

The following components must be included to build RStudio Desktop on Linux:

  • Desktop gcc 64-bit
  • Qt WebEngine

Additional Dependencies (macOS)

C/C++ Tools

The C/C++ development tools required RStudio development can be obtained by installing the Command Line Tools for XCode. You can do this one of two ways. Either:

  1. Download and install XCode from the Mac AppStore: http://itunes.apple.com/us/app/xcode/id497799835?mt=12
  2. From a terminal, execute:
xcode-select --install

Or alternatively (for a smaller download size):

  1. Register as an Apple Developer (free) here: https://developer.apple.com/programs/register/
  2. Download the Command Line Tools for Xcode appropriate for the version of OS X you are running from here: https://developer.apple.com/downloads/

Other Dependencies

You should install the latest version of CMake from here:

Finally, you can install the remaining dependencies (including the Boost C++ libraries) using the script at:

rstudio
   dependencies
      osx

You should switch to this directory and then execute:

./install-dependencies-osx

Note that this script requires Homebrew.

Also Note: As part of the install-dependencies-osx script, brew will install both ant and openjdk@11. If you run into GWT compile issues, make sure JAVA_HOME is set to use JDK 8 or 11, for example you can set it to 11 by running export JAVA_HOME=`/usr/libexec/java_home -v 11` (or adding it to your .zshrc).

Alternatively, on Mac or Linux (but not Windows), try using the shell script src/gwt/ant instead of running ant directly. This script will attempt to use the correct JDK (must be already installed) without you having to set JAVA_HOME yourself.

Another troubleshooting step when encountering GWT build failures (especially of the form "class file has wrong version" is to run ./ant clean then try building again.

Java Tools

In order to build the RStudio client GWT code, you need a JDK as well as the Ant build tool. You can install Java 8 or 11 from the following URL (note that newer JDKs are currently unsupported):

Next, you can install Ant from one of the following URLs:

Qt SDK for macOS (RStudio Spotted-Wakerobin or older)

If you are building against main, then the Qt SDK is no longer required. Starting with the Elsbeth-Geranium release (late 2022) we have moved RStudio Desktop off of Qt and onto Electron.

To build an older branch of RStudio Desktop, the Qt 5.12.10 SDK must be installed from https://qt.io.

5.12.10 won't show up automatically when installing via the Qt online installer. To reveal it, click the "Archive" checkbox on the "Select Components" screen, then the Filter button. The list of available versions will expand to include all versions.

You should download and install this to the default location on your system (~/Qt).

The following components must be included to build RStudio Desktop on macOS:

  • Qt WebEngine
  • macOS

Additional Dependencies (Windows)

R

On Windows, prefer installing R into a location where your user account has write permissions (e.g. C:\R\R-x.y.z). This is necessary as RStudio will generate export libraries for the MinGW DLLs used by RStudio, so that the libraries can be consumed by MSVC. If you are not sure, reinstalling R under C:\R\ will save some configuration time later on.

You will also want to be sure that the R executable is in your system or user %PATH%, such that typing R in cmd.exe starts the R interpreter. This is required by several RStudio dependency installation scripts.

Qt SDK for Windows (RStudio Spotted-Wakerobin or older)

If you are building against main, then the Qt SDK is no longer required. Starting with the Elsbeth-Geranium release (late 2022) we have moved RStudio Desktop off of Qt and onto Electron.

To build an older branch of RStudio Desktop, the Qt 5.12.10 SDK must be installed from https://qt.io.

5.12.10 won't show up automatically when installing via the Qt online installer. To reveal it, click the "Archive" checkbox on the "Select Components" screen, then the Filter button. The list of available versions will expand to include all versions.

You should download and install this to the default location on your system (C:/Qt).

The following components must be included to build RStudio Desktop on Windows:

  • MSVC 2017 64-bit
  • Qt WebEngine

Microsoft Build Tools

RStudio uses Microsoft Build Tools 2017 for compilation on Windows. These can be downloaded here: https://www.visualstudio.com/vs/older-downloads/. Install these tools to the default location. If you're using Qt Creator during development, it should automatically detect this as a 'kit' to use with RStudio.

CMake

You should install the latest version of CMake from here: CMake Download

NOTE: You should choose the "Add to system path" option during the installation.

Java Tools

In order to build the RStudio client GWT code, you need a JDK as well as the Ant build tool. You can install Java 8 from the following URL (note that Java 9 and 10 are currently unsupported):

Next, you can install Ant from one of the following URLs:

Installer Tools

If you want to build RStudio installers for Windows, you should also install the Nullsoft Installer System (NSIS) from here: http://nsis.sourceforge.net

Other Dependencies

You can install the remaining dependencies (including the Boost C++ libraries) using the script at:

rstudio
   dependencies
      windows

You should switch to this directory and then execute:

install-dependencies.cmd

Updating the System Path

Building RStudio requires that the CMake, and Qt be accessible via the system path (note that CMake should already be accessible via the CMake installer if the "Add to system path" option was chosen during installation). For Qt, you should ensure that the following additional directories are available on the path:

C:\Qt\Qt<version>\Tools\QtCreator\bin

Finally, you should also ensure that your R installation's bin directory is on the system path. For example:

C:\Program Files\R\R-3.0.1\bin\i386

Building from Qt Creator

  • Open Qt Creator, Projects then Manage Kits.
  • Make sure the MSVC 2017 kit is the default.
  • If you didn't install R at the recommended location (C:\R), you will need to manually run the script that generates MSVC compatible export libraries for each of the R dlls. Follow the instructions below to do so:
    • Open a terminal as administrator
    • Navigate to the RStudio repo base folder
    • Run the following command: <Path to R installation>\bin\x64\Rscript.exe src\cpp\tools\dll2lib.R
      • The path to your R installation will change depending on what version of R you installed and what settings you chose at install time. (e.g. C:\Program Files\R\R-3.4.4)
    • Repeat this for x86 by running the following command: <Path to R installation>\bin\x86\Rscript.exe src\cpp\tools\dll2lib.R

Windows SDK

To make sure rstudio.bat runs correctly, install the latest version of Windows SDK from https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk, you might need to uninstall the installed version first, make sure at least the following options are selected:

Debugging tools for Windows
Windows app certification kit
Windows SDK Signing tools for desktop apps
Windows SDK for Desktop C++ x86 Apps
Windows SDK for Desktop C++ amd64 Apps

Miscellaneous

  • RStudio uses git during the build + install phases with cmake. On Windows, you can use the the Git installer provided here -- after installing to the default location, you can put C:\Program Files\Git\cmd on the PATH (not C:\Program Files\Git\bin)
Clone this wiki locally