Skip to content

Installation: macOS

Kun Ren edited this page Jun 17, 2021 · 11 revisions

vscode-R

Install vscode-R in VS Code by searching ikuyadeu.r in extension marketplace.

If your R installation is from CRAN, then the default settings should work out of the box. Otherwise, you may have to change r.rterm.mac to the path to your R executable, which will be executed on command Create R Terminal.

If you are interested in the experimental features provided by R session watcher, you may enable it in the VS Code settings:

{
  "r.sessionWatcher": true
}

languageserver

languageserver is an implementation of the Language Server Protocol for R.

Run the following commands in R.

You may install the latest stable release from CRAN:

install.packages("languageserver")

or install the development version with the newest features:

remotes::install_github("REditorSupport/languageserver")

vscode-r-lsp

Install vscode-r-lsp in VS Code by searching reditorsupport.r-lsp in extension marketplace.

If the R installation is from CRAN, then the default settings should work out of the box. Otherwise, you may have to change r.lsp.path to the path to your R executable, which will be executed to start the R Language Server as a background process.

radian

radian is highly recommended as the R terminal for interactive use. It requires Python which should be available on macOS out of the box.

pip install -U radian

You may run which radian to see where your radian executable is located (typically, /usr/local/bin/radian).

Then the following VS Code settings should be updated to properly use radian as the default terminal.

{
  "r.bracketedPaste": true,
  "r.rterm.mac": "/usr/local/bin/radian"
}

VSCode-R-Debugger

VSCode-R-Debugger is a VS Code extension that implements R debugging capabilities. It depends on vscDebugger.

  1. Install VSCode-R-Debugger extension in VS Code.
  2. Install vscDebugger package via
remotes::install_github("ManuelHentschel/vscDebugger")

httpgd

httpgd is an R package to provide a graphics device that asynchronously serves SVG graphics via HTTP and WebSockets. It enables the plot viewer based on httpgd in VS Code.

  1. Install httpgd from CRAN
install.packages("httpgd")
  1. Enabled httpgd-based plot viewer by inserting the following option in your ~/.Rprofile:
options(vsc.use_httpgd = TRUE)