cat("R detected: ", R.version.string, "\n", sep = "")R detected: R version 4.3.2 (2023-10-31 ucrt)
This guide explains, step by step, how to install:
You need:
It is a good idea to close unnecessary programs before starting.
Open your web browser.
Go to https://cran.r-project.org.
Click Download R for macOS.
Download the latest .pkg installer for macOS.
Wait for the file to finish downloading.
Open the downloaded R .pkg installer.
Click Continue through the installation steps.
Click Install.
Enter your Mac password if asked.
Wait for installation to complete.
Click Close when finished.
Open Terminal.
Type:
R --versionYou should see something like:
R version 4.x.x
versionIf R is not found:
Close Terminal.
Install R again from CRAN.
Open a new Terminal window.
Test again with:
R --versionOpen your web browser.
Download the RStudio Desktop installer for macOS.
Wait for the file to download.
Open the downloaded RStudio file.
Drag RStudio into the Applications folder.
Open Applications.
Double-click RStudio.
If macOS shows a security message, click Open.
Open your web browser.
Download the Quarto installer for macOS.
Wait for the .pkg file to download.
Open the downloaded Quarto installer.
Click Continue through the installation steps.
Click Install.
Enter your Mac password if asked.
Wait for installation to complete.
Click Close.
Open Terminal.
Type:
quarto --versionYou should see something like:
1.x.x
Open RStudio.
Wait for the program to finish loading.
Confirm that the Console panel appears.
In the Console, type:
versionExample:
/Users/YourName/Documents/R-Projects
Open RStudio.
Use File > New Project or File > Open File… later when needed.
File > New File > Quarto Document
Choose HTML.
Save the file as:
test-quarto-mac.qmd
---
title: "My First Quarto Report"
format: html
---
# Hello Yahya
R, RStudio, and Quarto are working on Mac.In RStudio, open test-quarto-mac.qmd.
Click the Render button.
Wait for the HTML output to open.
Expected result:
A web page appears showing the title and the message.
In the RStudio Console, type:
install.packages("tidyverse")
install.packages("ggplot2")
install.packages("readxl")Press Return after each line, or paste all lines together.
In the RStudio Console, type:
installed.packages()[, "Package"]Look for packages such as:
This section displays the detected R version and Quarto version when this QMD file is rendered successfully.
If this section renders correctly, then R is installed and Quarto is available to render the document.
cat("R detected: ", R.version.string, "\n", sep = "")R detected: R version 4.3.2 (2023-10-31 ucrt)
quarto_path <- Sys.which("quarto")
if (nzchar(quarto_path)) {
cat("Quarto executable: ", quarto_path, "\n", sep = "")
} else {
cat("Quarto executable: Not found in PATH\n")
}Quarto executable: C:\PROGRA~1\Quarto\bin\quarto.exe
quarto_version <- tryCatch(
system2("quarto", "--version", stdout = TRUE, stderr = TRUE),
error = function(e) paste("Could not run quarto --version:", conditionMessage(e))
)
cat("Quarto version check:\n")Quarto version check:
cat(paste(quarto_version, collapse = "\n"))1.6.40
R --version and quarto --version.R not recognizedFix:
R --versionquarto not recognizedFix:
quarto --versionFix:
Try again in the RStudio Console with:
install.packages("tidyverse")Then repeat for the other packages.
You have now completed the following:
Create a second Quarto file and add:
Then render it to HTML.