PATH
For VScode, R needs to be on the PATH (locations where executables are found).
You can check this in the Terminal, also known as console, shell, bash, cmd.
For most other things (like git add -A or git clean -fd), you can use the terminal built into your IDE (RStudio, VScode).
For this particular check, I suggest using a clean OS-provided terminal:
Mac OS
- search (
CMD+SPACE) for “Terminal” - run the command
R - if it succeeds, it shows the R version and other info
- quit with
q("no")
Windows
- search (
Windows key) for “Terminal” - run the command
R.exe(if not using the Windows Powershell, justR) - if it succeeds, it shows the R version and other info
- quit with
q("no")
If R is not found / recognized, add it to the PATH:
- copy the path where you installed R - or - in RStudio -> Tools -> Global Options,
copy the path (e.g.
C:\Program Files\R\R-4.6.1) - search (
Windows key) for “env”, click- “Edit the system environment variables”
- or if you’re not an admin: “Edit the user environment variables”
- then click “Environment Variables” and
- under “System Variables” (in the bottom half)
- or for non-admin: under “User Variables” (in the top half)
- double click on “Path”
- click “New” and copy-paste your installation location (if from RStudio, add
\binat the end) - close the variable windows + the terminal, open a new one and try
R/R.exeagain.
Potentially restart Windows inbetween.
(optional guide with images)