Error resulting from Studio not finding build tools

Installed Stan. Error message when trying example code: "example(stan_model, package = "rstan", run.dontrun = TRUE)"

Prompted to install build tools. When complying the following error occured:
Error in compileCode(f, code, language = language, verbose = verbose) :
^/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/StanHeaders/include/stan/math/prim/fun/inv_inc_beta.hpp:32:23: note: in instantiation of function template specialization ‘boost::math::ibeta_inv<double, double, double, boost::math::policies::policy<boost::math::policies::overflow_errorboost::math::policies::errno_on_error, boost::math::policies::pole_errorboost::math::policies::errno_on_error, boost::math::policies::promote_double, boost::math::policies::digits2<>>>’ requested here return boost::math::ibeta_inv(a, b, p, boost_policy_t<>()); ^11 warnings and 1 error generated.make: *** [file63242869be2.o] Error 1

I run Rstudio v. 2024.04.2+764 on macOS Sonoma 14.5

Any ideas on how to get past the error?