Install R & RStudio on Mac OS

Spread the love

R Programming language comes with a Mac Installer package to install it on Mac (macOS) and it also comes with an RStudio IDE to run R programs. The RStudio IDE is a collection of integrated tools that helps you to write R programs and test. It includes a console, syntax-highlighting editor that supports direct code execution, and a variety of robust tools for plotting, viewing history, debugging, and managing your workspace.

1. Download R Package for Mac (macOS)

First, let’s download the R package for Mac (macOS) from the below URL. R installer is available for Windows, Linux, Mac e.t.c

Select the Download R for macOS option and choose the version you wanted to run R programs. This downloads the r*.pkg file to your system.

2. Install R Package on Mac (macOS)

Once the download completes, open the downloaded folder and install the R package on Mac. You should see something like this below.

Follow the instructions on the screen and complete the installation of the R package with the default settings. Once complete you should get the following screen

3. Install XQuartz (Optional)

If it is needed for you, install XQuartz by downloading from the same link you used to download the R language.

4. Download and Install RStudio IDE on Mac (macOS)

Download rstudio IDE by accessing the below URL.

Scroll down and choose the free version to download. This takes you to the RStudio versions available to download. Choose the R version based on your mac os version. Once downloaded successfully, open it to install. Follow the instruction on the screen to complete the installation.

This completes the installation of R and RStudio from Mac (macOS)

5. Open RStudio

Open the RStudio application from the dock or from the applications and you should see something like the below screen and you will have RStudio with the prompt. From this prompt, you can run any R programming language statements.

install rstudio for r

Now let’s run the hello world program in R, here I will just enter print('Hello World') at the prompt and press enter to execute the R snippet. Once you successfully run this and you can explore either the R language statements or jump to R Vector, R Matrix, and R Data Frames.

# Print Hello World
> print('Hello World')
[1] "Hello World"

If you wanted to use third-party packages like dplyr you need to install the package first.

6. Conclusion

I hope you are able to successfully download and install the R language/package and RStudio on Mac (macOS) to run the R programs. RStudio is an editor to write and executing R programs.

Naveen (NNK) is a Big Data and Spark examples community page, all examples are simple and easy to understand and well tested in our development environment Read more ..

Leave a Reply

You are currently viewing Install R & RStudio on Mac OS