@lakemonster Sorry for the hassle but glad it’s working now!
Hi everyone!
I am new to RStan. I am trying to run a model with RStan but all in vain. It looks like RStan is not properly installed or I am missing any part of it. Could someone please guide me how to uninstall and reinstall RStan on my Mac?
I am using macOS Catalina version 10.15.7
Thank you!
What version of R?
Its 1.3.1093
I think that is your version of RStudio (which also could stand to be upgraded). What is the result when you execute
R.version
in R?
I am sorry, 1.3.1093 is the version of R studio. the R version is 4.0.3 as shown by the command R.version.
In the case of R 4.x, then you should be able to install XCode and then do
file.remove("~/.R/Makevars")
file.remove("~/.Renviron")
# restart RStudio
install.packages("rstan", dependencies = TRUE, type = "binary")
and it should be fine.
How to I install Xcode?
I think I installed it using the instruction above but not sure it it is properly installed. I ran the command install.packages(“rstan”, dependencies = TRUE, type = “binary”)
Rstan is installed but it still is not working. When I run the model it prompts me to install build toots and I click yes a couple of times but still doesn’t work.
Open a terminal and type:
xcode-select --install
I did and got the following:
error: command line tools are already installed, use “Software Update” to install updates
@bgoodri I seem to recall this from a while back, when OS X consistently said that the tools were not installed?
Possibly doing
library(rstan)
rstan_options(required = FALSE)
will allow it to go through but my guess is you would have to fix XCode so that R knows whether it is or is not installed.
How do I fix it? do you mean installing a newer version or changing its location?
Well, something is clearly wrong in that R doesn’t find your compiler it seems. So, I assume you have OS X 10.15.7,
- Remove
XCode
(and remove any other compiler you might have installed previously, e.g., usingbrew
). - Remove
rstan
,StanHeaders
, and otherStan
related packages. - Close
RStudio
and remove~/.R/Makevars
,~/.Rprofile
,~/.Renviron
. - Install
XCode
and then runxcode-select --install
in the terminal. - Restart your laptop (shouldn’t be needed but who knows…)
- Start
RStudio
. - Try to install what you need, i.e., rstan first using
install.packages("rstan", dependencies = TRUE, type = "binary")
Several of the steps above shouldn’t be needed, but let’s exclude things here…
Something strange is going on. when I run the command: Xcode-select --install,
I receive the message: error: command line tools are already installed, use “Software Update” to install updates
but when I check in app and library , there is no Xcode
not sure how to deal with this.
Go to App Store and download Xcode. I hope you did all the step above?
R
I am following the steps, when I run the command Xcode-select --install, it prompt me to install the command line tools which I click yes to install. then an error comes that:
“Can’t install the software because it is not currently available from the software update server”.
Then a software update for command line comes up.
I think that the command line tools might not be the updated one with software update.
Shall I update the software update to install command line tools or is there any other way to install the most recent one.
I am using macOS Catalina version 10.15.7.
Thank you!
Hmm, so you can’t install the command line tools. I honestly have no idea what might be causing this…
I can through the software update! I am not sure if that would be sufficient. when I checked the apple developers website, I don’t find command line tools for 10.15.7 Mac OS version. therefore I am not sure which version to install.
Install Xcode through software update, then run xcode-select --install
in the terminal.