I am using rstan 2.19.3 and RStudio Version 1.1.453.
When I save the following stan code:

functions {
real anorm(real theta,
real mean,
real sq){
return (1 + expm1(-(1/(2 * sq)) * (theta - mean)^2));
}
}

with “Check on Save” ticked I get this in the Console:

R>rstan:::rstudio_stanc(“mre.stan”)
mre.stan is syntactically correct.
which is as it should be.
But if I add another term to the function definition in my stan code, thus:

functions {
real anorm(real theta,
real mean,
real sq){
return sqrt(1/ (2 * pi * sq)) * (1 + expm1(-(1/(2 * sq)) * (theta - mean)^2));
}
}

and then save with “Check onSave” ticked, as before, I get this in the Console:

R>rstan:::rstudio_stanc(“mre1.stan”)
R>
which is no good.

I should have said. Yes I am running ` Macbook pro with Catalina 10.15.3.
If this is a Catalina problem is it solvable or do I have find a Mac without Catalina installed?

I am pretty sure that if you have the C++ toolchain installed correctly like in

then if you install rstan from source, the exceptions thrown by the parser in the event of an invalid Stan program should be handled appropriately, rather than what you are seeing.