Need assistance downloading R for Mac


#1

I am currently taking data camp courses to learn R and would like to download R and RStudio for my mac. I need assistance in what to do for R as the website [https://cran.r-project.org/bin/macosx/] has me a bit confused. I am running OSX 10.13.16

Please help
Thanks!


#2

Hi! Welcome! (and welcome to R!)

I know the R for Mac download page isn't exactly beginner friendly! Here are some step-by-step instructions:

  1. Go to https://cran.r-project.org/bin/macosx/
  2. Click on the link that says R-3.5.1.pkg — the R installer will begin downloading. It will most likely wind up in your Downloads folder.
  3. Go to your Downloads folder and find the file called R-3.5.1.pkg. Double-click on it to open the R installer.
  4. The installer will lead you through the installation process.
  5. When you're all done, it's OK to delete R-3.5.1.pkg, if you want.

Now you've done the basics! Hopefully this is enough for your DataCamp courses. However, it's increasingly necessary to have some R developer tools installed as well as R itself, since getting the latest versions of popular packages may require you to compile them from source. If you want, you can continue on to install these additional tools (or you can wait until you run into trouble later!).

Additional R Tools

  1. XQuartz (allows you to use packages that depend on the X11 windowing system, a UNIX thing):

    • Go to https://www.xquartz.org and click on the link to download XQuartz-2.7.11.dmg.
    • When the file has downloaded, find it in your Downloads folder and double-click it.
    • A disk image will mount (looks like a new Finder window opening up). Double-click on XQuartz.pkg in that window.
    • The installer will open and lead you through installation.
  2. clang (a compiler for the C language):

    • Go to https://cran.r-project.org/bin/macosx/tools/ and click on the link to download clang-6.0.0.pkg.
    • When the file has downloaded, find it in your Downloads folder and double-click it.
    • The installer will open and lead you through installation.
  3. GNU Fortran (a compiler for the Fortran language):

    • Go to https://cran.r-project.org/bin/macosx/tools/ and click on the link to download gfortran-6.1.pkg.
    • When the file has downloaded, find it in your Downloads folder and double-click it.
    • The installer will open and lead you through installation.

#3

Thanks! Works perfectly.


#4

Thank You for your help! I was able to easily install everything


#5

Long-term, I lightly recommend Homebrew, which via its brew cask command can install applications including both R and RStudio. In Terminal, install Homebrew (copy the command from the link above), then enter

brew cask install r-app
brew cask install rstudio

The benefit of this approach is that it makes it really easy to update later:

brew cask upgrade

Homebrew Cask can also install other full applications, which is sometimes handy, though Homebrew itself was originally intended (and is still heavily used for) installing and updating command line utilities, e.g. git, compilers, pandoc (for RMarkdown), imagemagick, hugo (for blogdown), etc.

To be clear, Homebrew is by no means necessary (particularly if the command line is still daunting), and you can always start using it later if you choose. It's pretty awesome, though.


#6

Sorry I am new to all of this,so can you explain home-brew a little more in depth please. What I'm gathering from your post and their website is that home-brew manages all files better and basically once installed... updating R and RStudio will be more simple because I can just check the command prompt for updates?


#7

Yep, homebrew is a package manager for macOS that makes updating software a lot easier. If it's too confusing, just ignore it for now, though.


#8

Thank you. I already used it. Is there any documentation where I can learn the coding and commands for home-brew ?


#9

There are official docs:

much of which you can access through the command line once you get comfortable. They make it seem a lot more complicated than it is, though. For the basics (all most people ever need), see my post here:


#10

Thanks! I'll be sure to check it out!