vendor-install: handle native ARM running under Rosetta
Since `HOMEBREW_PROCESSOR` is populated using `uname -m`, this will
register as `Intel` even when a native ARM install is running under
Rosetta.
Let's work around this by checking `sysctl -n machdep.cpu.brand_string`.
On my Intel machine:
❯ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i3-1000NG4 CPU @ 1.10GHz
On Apple Silicon:
brew@HMBRW-A-001-M1-001 ~ % sysctl -n machdep.cpu.brand_string
Apple M1
The case of a Rosetta installation of Homebrew is already handled below
the proposed change.
Fixes Homebrew/discussions#2434.
This commit is contained in:
parent
6c341516d3
commit
8aeb28781c
@ -14,7 +14,8 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"
|
|||||||
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
|
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
|
||||||
if [[ -n "${HOMEBREW_MACOS}" ]]
|
if [[ -n "${HOMEBREW_MACOS}" ]]
|
||||||
then
|
then
|
||||||
if [[ "${HOMEBREW_PROCESSOR}" == "Intel" ]] ||
|
if [[ "${HOMEBREW_PROCESSOR}" == "Intel" &&
|
||||||
|
"$(sysctl -n machdep.cpu.brand_string)" != "Apple"* ]] ||
|
||||||
# Handle the case where /usr/local/bin/brew is run under arm64.
|
# Handle the case where /usr/local/bin/brew is run under arm64.
|
||||||
# It's a x86_64 installation there (we refuse to install arm64 binaries) so
|
# It's a x86_64 installation there (we refuse to install arm64 binaries) so
|
||||||
# use a x86_64 Portable Ruby.
|
# use a x86_64 Portable Ruby.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user