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
- Go to code.visualstudio.com.
- Click the large Download button.
- 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
- Run the downloaded
.exe. - Accept the agreement, keep the default location, click through, then Install and Finish.
macOS
- Open the
.dmgand drag Visual Studio Code into Applications. - Open it from Applications.
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install codeStep 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.
3. GitLens, recommended
Search for GitLens and install. It shows who changed each line and when, making your Git history easy to read as you learn version control.
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
- Click the Accounts icon (bottom-left) or the Source Control icon (branch symbol).
- 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.
- File, Open Folder and choose a folder (for example, your cloned course workspace).
- Create a file called
hello.Rand type:
print("Hello, Communication Liaison!")- 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.
- 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 statusto check your repositoryRto start an interactive R sessionquarto renderto 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
- Open the Command Palette (
Ctrl/Cmd+Shift+P) and run Git: Clone. - Paste the repository URL and choose a folder.
- 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
- Installed VS Code.
- Installed the R, Quarto, and GitLens extensions.
- Connected GitHub.
- Opened a workspace and ran R from the editor.
- Next: finish Install R, then set up your course workspace.
Resources
- VS Code docs: code.visualstudio.com/docs
- R in VS Code: REditorSupport wiki
- Git in VS Code: code.visualstudio.com/docs/sourcecontrol/overview
- Keyboard shortcuts: code.visualstudio.com/shortcuts
Questions? Press F1 for the Command Palette, check the docs, or come to office hours.