Hello,
I am very new to rstan. I have installed the package “rstan” in my Rstudio. However, whenever I run the function stan() (e.g., fit2=stan(file = here(“kids2.stan”), data = data, chains = 3, iter = 500)), I will be asked to install build tools, which says “Building R package from source requires installation of additional build tools; Do you want to install the additional tools now?” Then it will direct me to install XCode. However, I already have Xcode Command Line Tools installed and I don’t want to install the full Xcode package since it will take a lot of space. If I ignore the message which forces me to install XCode, I will not be able to run the stan() function. I will get an error message as follows:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error in compileCode(f, code, language = language, verbose = verbose) :
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrunError in if (nzchar(cxx)) { : argument is of length zeroCalls: → .shlib_internalIn addition: Warning message:In system(paste(MAKE, p1(paste(“-f”, shQuote(makefiles))), “compilers”), : running command ‘make -f ‘/Library/Frameworks/R.framework/Resources/etc/Makeconf’ -f ‘/Library/Frameworks/R.framework/Resources/share/make/shlib.mk’ -f ‘/Users/gavinleung/.R/Makevars’ compilers’ had status 1Execution halted
Error in sink(type = “output”) : invalid connection
I have googled and tried different ways to solve the issue but still could not figure out what the problem is here. Any help is very much appreciated!
Here are other specs that might be useful:
- Operating System: macOS Ventura, Version 13.6.1
- Rstudio Version: Version 2023.12.1+402
Both R and Rstudio have been upgraded to the latest versions.