Skip to main content
Use the instructions below based on your RStudio version, to set custom preferences (such as themes, key mappings, languages, and dictionaries) for RStudio workspace runs. For more information on RStudio session settings, see RStudio’s official documentation site.

RStudio version 1.3+

RStudio versions 1.3+ use /home/ubuntu/.config/rstudio/rstudio-prefs.json to store user preferences. You can use a pre run script in a custom compute environment to modify this file to launch RStudio with custom preferences. To learn more about the schema of rstudio-prefs.json, see RStudio’s official documentation on Customizing Session Settings.

Method 1: Write lines to settings file

If you know how to manually add configuration lines to the rstudio-prefs.json settings file, you can write it in the pre run script. For example:

Method 2: Copy a saved settings file

Use this method to copy the settings from an existing RStudio session. This method is useful if you aren’t familiar with the syntax of rstudio-prefs.json, or if you want to use preferences from an existing preference file.
  1. Run a session and modify the RStudio preferences as needed.
  2. Before you stop the session, use the following R code to copy the rstudio-prefs.json file to the root of your project directory.
  3. Add the following lines to the pre run script of your environment definition to load the preferences file (if it exists) on subsequent runs:

RStudio version 1.2 and lower

Older versions (1.2 and lower) of RStudio use /home/ubuntu/.rstudio/monitored/user-settings/user-settings to store user preferences. To launch RStudio with custom preferences, you can use the pre-setup script in a custom compute environment to modify this file.

Method 1: Write lines to settings file

If you know what to add to the settings file, you can write it in the pre-setup script. For example:

Method 2: Copy a saved settings file

Use this method to copy the settings from an existing RStudio session. This method is useful if you aren’t familiar with the syntax of rstudio-prefs.json, or if you want to use preferences from an existing preference file.
  1. Run a session and modify the RStudio preferences as needed.
  2. Before you stop the session, use the following R code to copy the user-settings file to the root of your project directory.
  3. Add the following lines to the pre-setup script of your environment definition to load the preferences file (if it exists) on subsequent runs:
The sed statement that deletes the initialWorkingDirectory variable ensures that your session starts with the correct working directory.
Last modified on June 15, 2026