Chapter 6 Installing and Configuring Quarto
Quarto is a scientific publishing system that allows you to create beautiful documents, presentations, and websites that combine code, text, and visualizations.
What you’ll accomplish:
- ✅ Install Quarto CLI (command-line interface)
- ✅ Configure Quarto in RStudio
- ✅ Configure Quarto in VSCode
- ✅ Create and render your first Quarto document
6.1 What is Quarto?
Think of Quarto as a tool that lets you write living documents where:
- 📝 Text explains your analysis
- 💻 Code performs calculations
- 📊 Results (tables, plots) appear automatically
- 🎨 Everything looks professional and polished
Quarto vs R Markdown:
If you’ve heard of R Markdown (.Rmd files), Quarto is its modern successor! Quarto:
- ✅ Works with R, Python, Julia, and more
- ✅ Has better syntax and features
- ✅ Creates more output types (websites, books, presentations)
- ✅ Is actively developed by Posit (the RStudio company)
For this course, we’ll use Quarto exclusively.
6.2 Step 1: Download Quarto
Go to the Quarto download page:
https://quarto.org/docs/get-started/
Click the download button for your operating system:
- Windows:
quarto-*-win.msi - macOS:
quarto-*-macos.pkg - Linux:
.debor.tar.gzdepending on your distribution
6.3 Step 2: Install Quarto
6.3.1 Windows Installation
- Locate the downloaded
.msifile - Double-click to launch the installer
- Click “Next” through the setup wizard
- Installation folder: Keep default (
C:\Program Files\Quarto) - Click “Install”
- Wait for installation (~1 minute)
- Click “Finish”
6.3.2 macOS Installation
- Locate the downloaded
.pkgfile - Double-click to launch the installer
- Click “Continue” through introduction
- Agree to the license
- Click “Install”
- Enter your Mac password when prompted
- Click “Close”
6.3.3 Linux Installation (Ubuntu/Debian)
Download the .deb file, then run:
For other distributions, see: https://quarto.org/docs/get-started/
6.4 Step 3: Verify Quarto Installation
Let’s confirm Quarto is installed correctly.
6.4.1 Verify in Terminal/Command Prompt
Open a terminal (macOS/Linux) or Command Prompt (Windows) and type:
You should see something like: 1.5.57 (version number may vary)
Command not found?
- Restart your computer to update PATH variables
- Windows: Make sure you chose “Add to PATH” during installation
- macOS/Linux: Quarto should be automatically available at
/usr/local/bin/quarto
If still not working, reinstall Quarto and ensure “Add to PATH” is selected.
6.5 Step 4: Configure Quarto in RStudio
RStudio has excellent built-in support for Quarto!
6.5.1 4.1 Check Quarto is Detected
- Open RStudio
- Click Tools → Global Options → Quarto
You should see the Quarto version detected:
Path shown:
RStudio should show the path to Quarto, like:
- Windows: C:\Program Files\Quarto\bin\quarto.exe
- macOS: /usr/local/bin/quarto
6.5.2 4.2 Create Your First Quarto Document in RStudio
Click File → New File → Quarto Document…
In the dialog:
- Title: “My First Quarto Document”
- Author: Your name
- Format: HTML (default)
- Engine: Knitr (default)
Click “Create”
You’ll see a template .qmd file with example content:
6.5.3 4.3 Render the Document
Click the “Render” button at the top of the editor (or press
Ctrl+Shift+K/⌘+Shift+K)RStudio will:
- Run the R code in the document
- Create plots and tables
- Generate an HTML file
- Open the result in the Viewer pane
First render taking a while?
The first time you render a Quarto document, RStudio may need to install additional packages. This is normal and only happens once!
6.5.4 4.4 Explore the Quarto Document Structure
Take a look at the .qmd file you just created. It has three main parts:
6.5.4.3 Code Chunks
R code goes inside ```{r} blocks and runs when you render.
Quarto Cheat Sheet:
Quarto has a helpful cheat sheet! Download it from:
https://rstudio.github.io/cheatsheets/quarto.pdf
Keep it handy when writing documents!
6.6 Step 5: Configure Quarto in VSCode
VSCode also has excellent Quarto support through the extension you installed in Chapter 3.
6.6.1 5.1 Verify Quarto Extension is Installed
- Open VSCode
- Click the Extensions icon (four squares) or press
Ctrl+Shift+X/⌘+Shift+X - Search for “Quarto”
- You should see “Quarto” by Quarto.org marked as “Installed”
Extension not installed?
Go back to Chapter 3, Step 4.3 to install it!
6.6.2 5.2 Create Your First Quarto Document in VSCode
Click File → New File or press
Ctrl+N/⌘+NClick “Select a language” at the bottom
Type “Quarto” and select it
Paste this template content:
---
title: "My First Quarto Document in VSCode"
author: "Your Name"
format: html
---
## Introduction
This is a Quarto document created in VSCode!
## R Code Example
```{{r}}
# Simple calculation
x <- 5
y <- 10
result <- x + y
print(paste("The sum is:", result))
```
## Plot Example
```{{r}}
# Load ggplot2
library(ggplot2)
# Create a simple plot
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
labs(title = "Car Weight vs MPG",
x = "Weight (1000 lbs)",
y = "Miles per Gallon") +
theme_minimal()
```
## Conclusion
Quarto makes it easy to combine code, text, and visualizations!- Save the file: File → Save As → Name it
test_vscode.qmd
6.6.3 5.3 Render the Document in VSCode
There are three ways to render a Quarto document in VSCode:
6.6.4 5.4 View the Rendered Output
After rendering, VSCode will:
- Generate an
test_vscode.htmlfile in the same folder - Open a preview pane showing the rendered document
Live Preview:
The Quarto extension offers live preview — as you type, the preview updates automatically! Toggle it on/off with the “Preview” button.
6.7 Step 6: Quarto Output Formats
Quarto can render to multiple formats! Try these:
6.8 Video Tutorial: Getting Started with Quarto
Video not loading?
Watch on YouTube: Getting Started with Quarto
6.9 Summary Checklist
Before moving to the next chapter, make sure you have:
Troubleshooting:
Render fails with “R not found”: - Make sure R is installed (see Chapter 4) - Restart RStudio or VSCode
Plots don’t appear:
- Make sure required packages are installed (install.packages("ggplot2"))
- Check that your code chunk has {r} and not just {}
Still stuck? Reach out via email or office hours!