dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib r r

dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib


Let's see if the installed version of openblas is 0.2.20:

brew info openblas openblas: stable 0.3.0 (bottled), HEAD [keg-only]Optimized BLAS libraryhttps://www.openblas.net//usr/local/Cellar/openblas/0.3.0 (22 files, 139MB)  Poured from bottle on 2018-05-31 at 20:42:55From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb==> DependenciesRequired: gcc ✔==> Options--with-openmp        Enable parallel computations with OpenMP--HEAD        Install HEAD version==> CaveatsThis formula is keg-only, which means it was not symlinked into /usr/local,because macOS provides BLAS and LAPACK in the Accelerate framework.For compilers to find this software you may need to set:    LDFLAGS:  -L/usr/local/opt/openblas/lib    CPPFLAGS: -I/usr/local/opt/openblas/includeFor pkg-config to find this software you may need to set:    PKG_CONFIG_PATH: /usr/local/opt/openblas/lib/pkgconfig

We have 0.3.0 but R is looking for 0.2.20

To fix this, we can create a symlink from the installed dylib:

ln -s /usr/local/opt/openblas/lib/libopenblas.dylib \      /usr/local/opt/openblas/lib/libopenblasp-r0.2.20.dylib

It works!

RR version 3.5.0 (2018-04-23) -- "Joy in Playing"Copyright (C) 2018 The R Foundation for Statistical ComputingPlatform: x86_64-apple-darwin17.4.0 (64-bit)


Another solution is simply to reinstall R:

brew reinstall r

This will relink R against the correct libraries, and you won't have any symlinks that might get orphaned or cause problems later. This won't affect any R packages you have already installed. Also, if you've already installed the most recent version of R with brew and the bottle is still on your computer then you won't have to download the bottle again.


In my case running uninstall and reinstall didn't resolve the issue. Running brew doctor revealed I had unlined kegs including gcc running brew link gcc fixed the issue.