Big Sur installation instructions for R need an update

As far as I can tell, the quick start guide for Macs is out of date. Some of my students have had trouble installing rstan and brms on Big Sur on a Mac. The problem seems to be the toolchain instructions. The following post seems to explain how to install gfortran. The toolchain per se cannot be installed as instructed on the quick start guide for rstan etc.

https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/

thanks,

Shravan

2 Likes

Thanks for reporting. I am not a Mac user myself, but tagging @jonah and @andrjohns as they are hopefully the right people to suggest changes to installation instructions.

Sorry for the delay on this. The truth is that I don’t fully understand what’s needed on Big Sur for RStan.

I do agree that the instructions seem insufficient for Big Sur. That said, the linked post doesn’t mention Big Sur either (the latest version it seems to mention is Catalina unless I missed something), so I’m not sure sure what we should be recommending for Big Sur. I also remember that I had trouble on one computer particularly with Big Sur and RStan unless I installed StanHeaders and RStan from source but I don’t know if that’s generalizable to other people.

@bgoodri @andrjohns Do you know anything about the requirements for running RStan with the latest Mac OS? I haven’t really been keeping up with RStan stuff as much since most of my energy was redirected to CmdStanR development.

1 Like

Hi Jonah and others,

Thanks for any help.

Some more info.

refers us to
Installer Package for macOS R toolchain

Seems that the installer package “macos-rtools-4.0.0.pkg”
does not meet the Mac OS Big Sur security requirements:

“macos-rtools-4.0.0.pkg” can’t be opened because Apple cannot check it for malicious software. This software needs to be updated. Contact the developer for more information."

Blithely proceeding with the install despite the warning goes only a bit further before returning the non-specific error:

The Installation Failed. The installation encountered an error that caused the installation to fail.

Note The installer package was developed by James Joseph Balamuta, and appears he had to pay for Developer certification of the package, which may no longer be valid under Big Sur OS?

(The instructions don’t mention Big Sur, but they do mention “Catalina or later.”)

2 Likes

I believe this will work if you are just trying to use stan. This is probably bad advice if you have other purposes for Xcode. It appears that the command line tools may have been causing issues with the c++ compiler? I got the idea from this github issue comment. These steps have allowed me to at least run the following example without error:

example(stan_model, package = "rstan", run.dontrun = TRUE)
  1. Uninstall Xcode by moving Xcode.app to trash and deleting the ~/Library/Developer folder
  2. Uninstall rstan and related packages
  3. Install Xcode from the app store (i.e., not from the terminal) and do not download the command line tools. If you try to open the Xcode.app it will ask you to download additional tools, decline this. Rstudio may also ask about installing additional tools when installing rstan from source–l also declined this and so far so good.
  4. run this in the terminal: sudo xcode-select --switch /Applications/Xcode.app
  5. run this from R console: install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

After those steps I was able to run the example above. This doesn’t feel like a great long term solution as I have to assume future updates from the stan community will solve the command line tools issues (if that is indeed the problem).

3 Likes

Dropping in to say that you saved my life with this. This indeed works and no need to install any toolchains separately.

This also applies to the newest macOS (Monterey) which is what I’m using.

Can we pump this answer up? :)

1 Like

curious about one thing, eventually i’d need the command line tools right? did anybody try gcc with homebrew, how did that work?