4 Settings

All of the settings file locations described in this section conform to the XDG Base Directory Specification. They are configurable using environment variables:

Scope OS Default XDG Base Variable RStudio Variable
User Windows %APPDATA%\RStudio XDG_CONFIG_HOME RSTUDIO_CONFIG_HOME
System Windows %PROGRAMDATA%\RStudio XDG_CONFIG_DIRS RSTUDIO_CONFIG_DIR
User Unix ~/.config/rstudio XDG_CONFIG_HOME RSTUDIO_CONFIG_HOME
System Unix /etc/rstudio XDG_CONFIG_DIRS RSTUDIO_CONFIG_DIR

Here, and in the rest of this section, “Unix” refers to both Linux and macOS.

In accordance with the Base Directory Specification, the XDG environment variables specify the location of the rstudio folder. For example, to store system-wide preference configuration in /var/config/rstudio/rstudio-prefs.json, you would set the XDG_CONFIG_DIRS variable to the value /var/config.

If specified, the RStudio variables take precedence over the XDG variables. These variables specify a specific directory (not a base directory). For example, to store system-wide preferences in /var/config/settings/rstudio-prefs.json, you would set the RSTUDIO_CONFIG_DIR variable to the value /var/config/settings.

4.1 Preferences

User preferences set in the RStudio IDE’s Global Options dialog can also be set in the JSON file rstudio-prefs.json, located in the settings directory described above.

4.1.1 Example

By default, RStudio Server asks to save the workspace after the R session ends, and it always loads the workspace when starting a new session. Some organizations prefer to disable this behavior in order to discourage users from accumulating too much ad-hoc state. To do so, set the following:

%PROGRAMDATA%\RStudio\rstudio-prefs.json

{
    "save_workspace": "never",
    "load_workspace": false
}

4.1.2 Reference

A full list of preferences and their possible values can be found in the RStudio Workbench Administration Guide. Ensure that you reference the version of the guide that matches your version of RStudio Desktop Pro, as options can change between versions.

4.2 Other Settings

The ~/.config/rstudio//etc/rstudio/ folders (or Windows equivalent as described above) contains several subfolders which can be used to install per-user content and/or system-wide defaults.

Folder Contents
themes .rstheme files defining additional editor color schemes
keybindings .json files defining custom keybindings
snippets .snippets files defining editor snippets
templates Default template content for new files created in RStudio
dictionaries Additional dictionaries and languages for spell-checking

More information on each of these folders and their contents can be found in the RStudio Workbench Administration Guide.