The following steps should be performed on your personal computer. If you already have R and RStudio installed skip to step 4.

  1. Download R from the link Click on Download R for (Mac) OS X. Choose the most up to date version R-4.3.1.pkg. Install the package by double-clicking on it and working through the prompts. Leave all default settings in the installation options.

  2. Download the free RStudio Desktop for mac from Double click the downloaded .dmg file. Drag RStudio icon to the Applications folder.

  3. Verify that RStudio and R are working together by double-clicking the RStudio icon. You should see a RStudio window with three panes.

  4. If have already installed R and RStudio just open RStudio and check for any updates by following the steps below. In your console type


This will show the R version you are running. If you need to update R you can use package updateR. This is the R code you will need to type in your console:

install.packages('devtools') #assuming it is not already installed

You will then be prompted to enter your admin password.

Another way to do it is just downloading the new version as in Step 1. Then restart your RStudio. The new R version will be loaded automatically. Then run the following command to update packages.


Also check if you have the latest version of RStudio. Just navigate to Help > Check for updates and you be redirect to the website in Step 2 if needed.

  1. Some functions in R require a “X11 server”. You can get this using XQuartz. Download the latest version from Open the downloaded DMG file and then double-click on the XQuartz.pkg. Follow the installation steps.

  2. Optional for this class. Some packages in R requires compilation. Download and install Xcode (developer tools to create applications for Mac). You can download it from your App Store or use the link: This will take a while and requires a recent version of iOS. If you are using an old mac, please skip this step.

  3. Now you need to install a package manager for macOS called Homebrew. From your Terminal type (or paste) the following command:

/bin/bash -c "$(curl -fsSL"
  1. Install git. Since you have Homebrew this will be simple. From your Terminal use the following command:
brew install git

This command you automatically update Homebrew and run the brew clean up. You also need to install git-gui, git’s commit GUI and interactive history browser, use the command

brew install git-gui

Make sure to set Git with your name and email address using the following commands on the Terminal with your name and email address.

git config --global "username" <br>
git config --global ""
  1. R has functions tied to latex. And we will use them in this class to generate pdf files. You will need to install MacTex. Download MacTeX.pkg from Double-click the pkg installer and follow the prompts. Leave all default settings in the installation options. This will also take a while!

And you are all set! Your computer is ready to do run any packages and functions you will need for this class.