Use WSL as terminal in RStudio desktop on Windows

On a Windows machine, I have WSL2 installed and working. I believe I can use the WSL2 shell as my terminal in RStudio desktop (note, I am not trying to run RStudio in WSL2, at least not yet). However, although I have seen screenshots where WSL bash appears as an option for the terminal (Global Options / Terminal), it does not show as an option for me. This is what I see:

image

Am I missing a trick to make WSL appear as a terminal option as in the screenshot mentioned above?

Note that inside RStudio, I can can run wsl commands inside the system function, and that works, showing that WSL is working and usable in a sense in RStudio.

> system('wsl pwd')
/mnt/c/Users/andrews/Documents
[1] 0

RStudio version: 2023.9.1.494, Desert Sunflower. Windows version: Windows 11 Pro, 22H2. WSL version: WSL version: 1.2.5.0

To answer my own question, while presumably there is a way for WSL to be an option for "New terminals open with:", I got the terminal to me the WSL shell by choosing the "Custom" option and adding the wsl.exe path as the shell binary:

image

It seems that that does the job :slight_smile:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.