I’m running into the well-known unserialize(socklist[[1]]) error:

```
Error in unserialize(socklist[[n]]) : error reading from connection
```

None of the posted fixes have worked for me: I don’t appear to have a Makevars file, so I can’t edit it; I’ve uninstalled and reinstalled everything and rebooted RStudio; I’ve renamed my .stan file to force a re-compile; and I’m running a (very slightly modified version of) one of the case studies posted on the STAN site, so I’m fairly sure it’s not a cockpit error :)

(N.B.: I’ve had this issue across multiple R and .stan files, including an exact copy of a file that runs perfectly on my collaborator’s R installation, but the 8-schools example runs OK.)

Thanks in advance! I’m a bit of an R novice, so hopefully it’s a simple fix.

My R code is here:

```
`library("splines")
library("rstan")
X <- seq(from=-5, to=5, by=.1) # generating inputs
B <- t(bs(X, knots=seq(-5,5,1), degree=3, intercept = TRUE)) # creating the B-splines
num_data <- length(X); num_basis <- nrow(B)
a0 <- 0.2 # intercept
a <- rnorm(num_basis, 0, 1) # coefficients of B-splines
Y_true <- as.vector(a0*X + a%*%B) # generating the output
Y <- Y_true + rnorm(length(X),0,.2) # adding noise
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
sm<-stan_model("fit_basis_rename.stan")
fit<-sampling(sm,iter=500,control = list(adapt_delta=0.95),data = list(X=X,Y=Y,B=B,num_data=num_data,num_basis=num_basis))
`
```

My STAN code is here:

```
data {
int num_data;
int num_basis;
vector[num_data] Y;
vector[num_data] X;
matrix[num_basis, num_data] B;
}
parameters {
row_vector[num_basis] a_raw;
real a0;
real<lower=0> sigma;
real<lower=0> tau;
}
transformed parameters {
row_vector[num_basis] a;
vector[num_data] Y_hat;
a = a_raw*tau;
Y_hat = a0*X + to_vector(a*B);
}
model {
a_raw ~ normal(0, 1);
tau ~ cauchy(0, 1);
sigma ~ cauchy(0, 1);
Y ~ normal(Y_hat, sigma);
}
```

My OS is macOS Catalina, 10.15.7. I’m running R 4.1.0 and rstan 2.21.2.

The output of `writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))`

is:

Error: object ‘writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”)))’ not found

I can provide any other information if needed. Thanks again!