R 4.1.2 crashes

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.3.1

I’m try to load and run rstan with the above session info. I have loaded the C++ toolchain and loaded and required rstan (following RStan Getting Started · stan-dev/rstan Wiki · GitHub).

> install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
trying URL 'https://cloud.r-project.org/bin/macosx/contrib/4.1/rstan_2.21.5.tgz'
Content type 'application/x-gzip' length 24565172 bytes (23.4 MB)
==================================================
downloaded 23.4 MB

The downloaded binary packages are in/var/folders/cj/_6nnjn3508d_8txxsz2g3n600000gq/T//Rtmp2EAcTk/downloaded_packages

But R aborts and crashes when I try to run the example code as suggested on the same webpage:

example(stan_model, package = "rstan", run.dontrun = TRUE)

When I try to run my own simple linear regression model through the rethinking package in R, I get the following error:

Error: CmdStan path has not been set yet. See ?set_cmdstan_path.

When trying to set the path, it isn’t being found:

> set_cmdstan_path(path = "Library/Frameworks/R.framework/Resources/library/rstan/")
Warning message:
Path not set. Can't find directory: Library/Frameworks/R.framework/Resources/library/rstan/

This is obviously the first time I’ve tried to install rstan, so any advice would be great. Thanks!