Before installing RStudio, please make sure that you have enough free space on your local mac. We will require this space to install both R and RStudio, and when the program installs, the compressed files expand to take much more space.
Now, let’s install R on Mac, and then we install RStudio.
Note: For RStudio to work on Mac, R needs to be installed first.
How to Install R in Mac
To Install R in mac, follow the below steps.
- Open the web browser and go to www.r-project.org.
- Click the “Download R” link in the middle of the page under “Getting Started.”
- Select the CRAN location (a mirror site) for nearest region and click the corresponding link.
- Click on the “Download R for (Mac) OS X” link at the top of the page.
- Click on the file containing the latest version of R under “Files.”
- Save the .pkg file, double-click it to open, and follow the installation instructions.
- After installing R, you need to download and install RStudio.
Double-click on the R icon in the Applications folder. A window titled “R Console” should pop up.
You maybe see something like below.
Here, we got some warnings that can be solved by following the below steps.
- Open Terminal
- Write or paste in:
defaults write org.R-project.R force.LANG en_US.UTF-8
- Close Terminal (including any RStudio window)
- Start R
That will resolve the issue, and now our r console looks like below.
The > character is called the prompt and is the place where we enter the commands for the program to interpret.
For instance, if you type 11+21 followed by the return/enter key, you will see:
That means the installation of R is successful.
To quit R, you have to. call the quit function by typing the q() in the console and hit the return key.
How to Install RStudio on Mac
To install RStudio in Mac For Free, you have to download it from the website first.
Go to the rstudio.com and click on the Free RStudio Desktop, which is free under Open Source License.
You will go to this page.
Then click on Download RStudio For Mac button, and it will save the .dmg file on your machine, double-click it to open, and then drag and drop it to your applications folder.
Now, open the RStudio, and it looks like below.
To exit RStudio, click “RStudio” in the menu bar, then click “Quit RStudio”. Alternatively, use the CMD + Q shortcut.
If prompted to save the workspace, do not save it.
If you want to get the Paid version or commercial version of RStudio, then go this link: https://rstudio.com/products/rstudio/download/
You will find various commercial versions for your needs.
So, that is it for installing R and RStudio on Mac.
Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language.