Install R On (Mac) OS X using Homebrew

Requisite: How to Install R using Homebrew on Mac OS X?

I use a Mac and I was utterly confused while installing R. I was desperately looking for steps to install R on my Mac. Well, I found two solutions:

1. Using Homebrew – The steps are mentioned below

2. Downloading installation package file from CRAN – I wrote another post on this and the link is here.

Step By Step Solution:

Homebrew is a “missing package manager for Mac OS”. If you are not sure which version of R to download or have questions regarding the compatibility with the OS, or how to download and then install R, Homebrew is a solution which enables installing the correct version after typing a single line instruction. Sounds easy, right? Also, for updating or upgrading the components or the libraries, a single line command is enough. So, below is the step-by-step process to Install Homebrew and then R.

Let’s start!

1. Press Command + Space bar on Mac to open the Search Bar

2. Write “Terminal” and press Enter

3. Once the Terminal is opened, write the below ruby code to install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The standard script installs Homebrew to ‘/usr/local’. Open the Search bar (Command+ Space bar) and type /usr/local and hit enter. “Homebrew” folder should be available.
4. Once the Homebrew is installed, write the below code to R
brew install R
If the full Homebrew is configured, write the below commands to keep everything up-to-date.
brew update
Find out what is outdated with the below code:
brew outdated
Upgrade everything with the below command:
brew upgrade
Once you are done with the configuration, start writing your code in R. If you are not sure where to start, find the steps here.

Happy Coding!
0

Leave a Reply

Your email address will not be published. Required fields are marked *