Error in new_CppObject_xp on MacOS RStudio

I have just installed rstan on my MacOS High Sierra Version 10.13.6, RStudio 1.2.5 042 R-3.6.3 and I followed the installation procedure on stan website but I get this error if I run the 8schools example.
I have tried a coupe of solution methods on this forum all to no avail, any help will be much appreciated.

See the error message:

library(rstan)
schools_dat ← list(J = 8,
y = c(28, 8, -3, 7, -1, 1, 18, 12),
sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
fit ← stan(file = “8schools.stan”, data = schools_dat)
Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
Exception: variable does not exist; processing stage=data initialization; variable name=N; base type=int (in ‘model19671219573f_8schools’ at line 14)

failed to create the sampler; sampling not done
.

Hi Steve,

The important part of the error message is:

Exception: variable does not exist; processing stage=data initialization; variable name=N; 

Which is saying that your Stan code has declared that an integer N will be included as data, but you haven’t done so. You just need to include the variable N in your schools_dat list, and you should be fine