Installing brms on macbook pro with M1pro silicon

Here’s what I get when I try to install brms in RStudio on the expensive and infuriating machine. I have installed gfortran in the correct place in “opt.” I can run
rstan successfully with this command:
example(stan_model, package=“rstan”,run.dontrun=TRUE)

When I do

install.packages("brms")

The result is:

installing the source package ‘brms’

trying URL ‘https://cran.rstudio.com/src/contrib/brms_2.16.3.tar.gz
Content type ‘application/x-gzip’ length 4957623 bytes (4.7 MB)

downloaded 4.7 MB

  • installing source package ‘brms’ …
    ** package ‘brms’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    Warning: namespace ‘brms’ is not available and has been replaced
    by .GlobalEnv when processing object ‘brmsfit_example1’
    Warning: namespace ‘diffobj’ is not available and has been replaced
    by .GlobalEnv when processing object ‘brmsfit_example1’
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j ← i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    there is no package called ‘igraph’
    Calls: … loadNamespace → withRestarts → withOneRestart → doWithOneRestart
    Execution halted
    ERROR: lazy loading failed for package ‘brms’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/brms’
    Warning in install.packages :
    installation of package ‘brms’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/h9/xx8h9px12c5dspwgfk1tpvt00000gn/T/RtmpaHWiYP/downloaded_packages’

Any help would be appreciated.
Be well.
Ted W. Simon