Install VS Code

Why VS Code?

VS Code (Visual Studio Code) is the editor you use for everything in this course: writing and running R, rendering Quarto documents, taking notes in your course workspace, and managing Git and GitHub. It is a professional, free, lightweight editor used by developers worldwide, and keeping all of your work in one editor means your code, your notes, and your reproducible report live together in a single workspace.

In this course VS Code is the standard environment. This guide installs it and sets up the extensions you need; pair it with Install R to run R inside it.


System requirements

  • Windows 10+, macOS 10.12+, or Linux (most distributions)
  • At least 200 MB of disk space
  • Runs comfortably on any computer that can run R

Step 1: Download VS Code

  1. Go to code.visualstudio.com.
  2. Click the large Download button.
  3. Pick your operating system:
    • Windows: “Windows (64-bit)”
    • macOS: choose Intel or Apple Silicon to match your chip
    • Linux: choose your distribution

Step 2: Install VS Code

Windows

  1. Run the downloaded .exe.
  2. Accept the agreement, keep the default location, click through, then Install and Finish.

macOS

  1. Open the .dmg and drag Visual Studio Code into Applications.
  2. Open it from Applications.

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install code

Step 3: Learn the layout

When VS Code opens you’ll see:

  • Left sidebar: file explorer, search, source control, extensions
  • Editor (center): where you write code and prose
  • Bottom panel: the integrated terminal and problems
  • Top bar: File, Edit, View, Run menus

Step 4: Install the course extensions

Open the Extensions view (Ctrl/Cmd+Shift+X) and install these. If you cloned the course workspace, it will simply prompt you to install its recommended set.

1. R (REditorSupport), required

Search for R by REditorSupport and click Install. This is what lets you run R, get completions, and view data inside VS Code. Finish the wiring in Install R.

2. Quarto, required

Search for Quarto and install. This previews and renders the .qmd documents you write for assignments and your final report.

Optional extras

  • Markdown All in One adds a table of contents, shortcuts, and list editing for Markdown.
  • Python (by Microsoft), only if you branch into Python. It is not required for this course.

Step 5: Connect to GitHub

  1. Click the Accounts icon (bottom-left) or the Source Control icon (branch symbol).
  2. Click Sign in with GitHub and complete authentication in your browser.

Now you can clone repositories, view history, and commit and push without leaving VS Code. See Getting Started with GitHub.


Step 6: Open your first workspace

In VS Code you work in a folder, not a project file. The open folder is your working directory.

  1. File, Open Folder and choose a folder (for example, your cloned course workspace).
  2. Create a file called hello.R and type:
print("Hello, Communication Liaison!")
  1. Put your cursor on the line and press Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac). VS Code starts an R terminal and runs it.
  2. You should see [1] "Hello, Communication Liaison!" in the terminal.

Step 7: The integrated terminal

Press Ctrl+` (backtick, below Escape) or View, Terminal. From here you can run:

  • git status to check your repository
  • R to start an interactive R session
  • quarto render to build a document

Type exit to close it.


Step 8: Essential keyboard shortcuts

Action Windows/Linux Mac
Open folder Ctrl+K Ctrl+O Cmd+K Cmd+O
Save file Ctrl+S Cmd+S
Run R line Ctrl+Enter Cmd+Enter
Find text Ctrl+F Cmd+F
Open terminal Ctrl+| Ctrl+
Command Palette Ctrl+Shift+P Cmd+Shift+P
Markdown preview Ctrl+Shift+V Cmd+Shift+V
Add comment Ctrl+/ Cmd+/

Step 9: Clone a repository

  1. Open the Command Palette (Ctrl/Cmd+Shift+P) and run Git: Clone.
  2. Paste the repository URL and choose a folder.
  3. Click Open when prompted.

Your whole repository is now in VS Code, ready to edit, commit, and push.


Step 10: Settings and customization

  • Theme: File, Preferences, Theme, Color Theme (Dark+, Light+, or a community theme).
  • Font size: Settings, search “font size”.
  • Format on save: Settings, search “format on save”, and check the box.

Common issues and fixes

The R extension cannot find R

Install R first (Install R), then in Settings search r.rpath and point it at your R executable. Restart VS Code.

Extensions won’t install

Check your internet connection, then try installing from the Extension Marketplace website. As a last resort, reinstall VS Code.

Terminal says “git: command not found”

Install Git (see Getting Started with GitHub) and restart VS Code.


Next steps

  1. Installed VS Code.
  2. Installed the R, Quarto, and GitLens extensions.
  3. Connected GitHub.
  4. Opened a workspace and ran R from the editor.
  5. Next: finish Install R, then set up your course workspace.

Resources

Questions? Press F1 for the Command Palette, check the docs, or come to office hours.