Search code examples
rxcodemacosxquartz

Why R needs XQuartz, Xcode and Fortran?


I would like to start with R. I use macOS. And I saw on the website of R that they mention to install XQuartz, Xcode (or Command Line Tools) and Fortran before. However, I wonder what these 3 things are good for in relation to R? Do I really need them, so that R runs? For what are they specifically used and what do they do?

Edit: At no point is it asked that I want a recommendation! It is asked what exactly the "things" do. To understand the functionality behind it.


Solution

  • These tools are recommended because they are sometimes useful (and it may be easier to install them up front rather than suddenly realizing you need them in the middle of a project). They are not required for basic use of R.

    From the R for MacOS web page [emphasis added]:

    the use of X11 (including tcltk) requires XQuartz

    • X11 is an older window management system that some packages use
    • tcltk is an older tool that some packages use for presenting interactive buttons/widgets/etc.
    • you might need this for the rgl package, which renders interactive 3D graphics

    If you wish to compile R packages which contain Fortran code, you may need to download the corresponding GNU Fortran compiler

    Most R packages are available in a pre-compiled binary format, in which case you don't need XCode or gfortran. If you want to install development versions of packages (e.g. from someone's GitHub repository), and those packages contain compiled (C++ or Fortran) code, then you'll need XCode. Sometimes you'll see a message when installing packages about "binary available, but source is newer. Compile from source?". In this case it's usually safe to say "no".