Library not loaded: @rpath/libtbbmalloc.2.dylib

I’m having trouble with rstan. Trying this

example(stan_model,run.dontrun = TRUE)

and getting this error

Error in dyn.load(libLFile) : 
  unable to load shared object '/var/folders/3t/0qwd7gmx5_sgqz60kl5hfvpw0000gn/T//RtmpmNDVK2/':
  dlopen(/var/folders/3t/0qwd7gmx5_sgqz60kl5hfvpw0000gn/T//RtmpmNDVK2/, 6):
Library not loaded: @rpath/libtbbmalloc.2.dylib
  Referenced from: /usr/local/opt/tbb/lib/libtbbmalloc_proxy.2.dylib
  Reason: image not found

Output of sessionInfo():

R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_2.21.2         ggplot2_3.3.5        StanHeaders_2.21.0-7

Could anyone help with a pointer to a solution?

Maybe this? Failing to load libtbbmalloc.2.dylib - githubmemory

1 Like

Thank you so much 🥲 This solved it!!

1 Like