Install Homebrew (if you still don't have it)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install R
brew tap homebrew/science
brew install r
When running r, I got the following error message:
dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/6/libgfortran.3.dylib
Referenced from: /usr/local/Cellar/r/3.3.1/R.framework/Versions/3.3/Resources/lib/libR.dylib
Reason: image not found
Trace/BPT trap: 5
To fix this error, I had to do this:
brew reinstall gcc --with-fortran