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

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.


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 library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.0 (22 files, 139MB)
  Poured from bottle on 2018-05-31 at 20:42:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ✔
==> Options
--with-openmp
        Enable parallel computations with OpenMP
--HEAD
        Install HEAD version
==> Caveats
This 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/include
For 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!

R

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