Error with “brew install openblas” in macOS

homebrewinstallationmacmacosmacos-highsierra

I am trying to install openblas on a macOS HighSierra 10.13.6 with the following command

brew install openblas

Unfortunately I get this error…

brew install openblas
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 1 cask.

Warning: You are using macOS 10.13.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
old version.

==> Downloading https://github.com/xianyi/OpenBLAS/archive/v0.3.17.tar.gz
Already downloaded: /Users/JohnRambo/Library/Caches/Homebrew/downloads/54106543af17b56e0603879978f1cc3f09459952d7a716fa5168ae43bef77a4e--OpenBLAS-0.3.17.tar.gz
==> make CC=gcc-11 FC=gfortran libs netlib shared
Last 15 lines from /Users/JohnRambo/Library/Logs/Homebrew/openblas/01.make:
                             ^
<stdin>:618:27: error: unexpected token in argument list
        vfmadd231ps     (%r12,%rsi,4){1to16}, %zmm2, %zmm1
                                     ^
<stdin>:623:23: error: unexpected token in argument list
        vmovups (%rcx), %zmm2{%k1}{z}
                             ^
<stdin>:624:2: error: instruction requires: AVX-512 ISA
        vfmadd132ps     %zmm0, %zmm2, %zmm1
        ^
<stdin>:625:23: error: unexpected token in argument list
        vmovups %zmm1, (%rcx){%k1}
                             ^
make[1]: *** [sgemv_n_SKYLAKEX.o] Error 1
make: *** [libs] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!


Error: You are using macOS 10.13.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
old version.

What can I do to fix this error?

Best Answer

For those who have old hardware and can't update to a newer macOS version, there is a solution pointed out in OpenBLAS-users group:

Edit file /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/openblas.rb and add "NO_AVX512=1" to the end of the first make call (at the time of writing it's on line 43), so it looks like:

system "make", "CC=#{ENV.cc}", "FC=gfortran", "libs", "netlib", "shared", "NO_AVX512=1"

And then run installation without updating brew (use HOMEBREW_NO_AUTO_UPDATE=1), otherwise it will stash the changes and revert the formulae to the original state:

HOMEBREW_NO_AUTO_UPDATE=1 brew install openblas
Related Question