Installing R on a Mac using Homebrew
How to install R environment for statistical computing using Homebrew.
Step 1 - XCode Command line
If you're on a Mac, you will need to first install XCode command-line tools.
Step 2 - Install Homebrew
Homebrew is a package manager for Mac and if you haven't installed it yet, follow this tutorial.
Step 3 - Install xQuartz
brew install cask
brew install caskroom/cask/xquartz
Step 4 - Install R
Finally, we can install R!
brew install r
Step 5 - TK Graphic Library
Let's be safe and install Homebrew Dupes which will allow you to have a duplicate on homebrew.
brew tap homebrew/dupes
Install the TK Graphical Library.
brew cask install tcl
Step 6 - Double Check Your Work
Running Doctor will ensure your system is stil healthy
brew cask doctor
Cleanup any files.
brew cask cleanup
Step 7 - Run R
If everything is working properly, you should be able to run
R (notice that it's capital) and the
TK GUI. This GUI is what you will be using to visualize your statistical questions.
R -g Tk &
If you're not sure where to go next, I suggest learning how to install a very popular graphics package called
ggplot2. Read my tutorial to learn more.
If homebrew ends up changing stuff and you can no longer find the right package, try
brew search <name of package>