Unable to install MacOS R toolchain


I am trying to install RStan on my Macbook (OS Catalina 10.15.1) in RStudio (version 1.0.143) using the steps on https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started. I checked whether the C++ toolchain is properly installed using the command

pkgbuild::has_build_tools(debug = TRUE)

which returned FALSE. I then followed the instructions to download the macOS R toolchain installer, and was able to download macos-rtools-3.2.2.pkg at https://github.com/rmacoslib/r-macos-rtools/releases/tag/v3.2.2.

My problem is that my Macbook won’t open this .pkg file because “because Apple cannot check it for malicious software”. I have tried to override this by right-clicking on the .pkg file and selecting Open, but even after overriding the security preferences to install the app, I get the following error code:

The operation couldn’t be completed. (OSStatus error -60008.)

Could anyone please help me figure out how to install this toolchain–maybe using the command line?

Thanks in advance!

@coatless ?

macOS added new developer requirements for installers that went into effect Jan 1st.


Solution: Resubscribe to the developer program. I might ping Bob Rudis to see if I can piggyback off of his credentials.

So, at the moment would your recommendation be the “manual install guide” from



Thanks for your replies. I followed the manual install guide above and the C++ toolchain appears to now be properly installed (pkgbuild::has_build_tools(debug = TRUE) returns TRUE).

Thanks again!

Yes, unfortunately, we’ll have to use the manual installation guide. :(

Unless anyone on Stan’s side has active Apple Developer credentials.

I don’t think any of the Stan developers does but quite possibly someone on the forum does. Or we might be able to fund it through the @SGB or @andrewgelman .

I’m on a Mac with a Big Sur operating system and an M1 chip, and the toolchain isn’t working, resulting only in a big message that says “Installation Failed.” This is a brand new computer with no prior installations of R, XCode, etc.

As an update, I managed to get things installed with insights from the manual install guide.

@jeremy.koster , do you happen to remember which version of gfortran you used? I’m running into the same problem you did and followed the instructions you linked. I tried downloading the experimental gfortran for the M1 chip (Release gfortran 11-experimental-2 for ARM Big Sur (macOS 11) · fxcoudert/gfortran-for-macOS · GitHub) but am getting an error when running the Rcpp test suggesting it didn’t work:

ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_2.so] Error 1

Regrettably, I don’t remember … it was matched to the Mac OS that I had at the time. I wish I could say more specifically, but I’ve changed to a different computer by now. Good luck. It’s frustrating, but persistence will probably get you there.

1 Like