Search code examples
ropenblas

Linking brew installed openblas to /usr/local


I have installed R that in turns installs openblas - but not to /usr/local :

==> openblas
openblas 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 openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

For pkg-config to find openblas you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

My primary use case for openblas is with R and scipy. The latter _no longer supports the Macos Accelerate package`: so there's no problem with redirecting to brew. The former will be using the brew anyways: so I see no harm in doing this. But how to do it?


Solution

  • Two steps made this work:

    • Uninstall openblas via brew:

      brew uninstall --ignore-dependencies openblas

    • Reinstall R

      brew install R

    • Manually create symbolic link to /usr/local :

      sudo ln -s /usr/local/opt/openblas /usr/local

    Now we have R !

    $R
    
    R version 3.6.1 (2019-07-05) -- "Action of the Toes"
    Copyright (C) 2019 The R Foundation for Statistical Computing
    Platform: x86_64-apple-darwin18.6.0 (64-bit)
    
     .. 
    
    >