File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -255,10 +255,19 @@ get_architecture() {
255255 fi
256256 fi
257257
258- if [ " $_ostype " = Darwin ] && [ " $_cputype " = i386 ]; then
259- # Darwin `uname -m` lies
260- if sysctl hw.optional.x86_64 | grep -q ' : 1' ; then
261- _cputype=x86_64
258+ if [ " $_ostype " = Darwin ]; then
259+ # Darwin `uname -m` can lie due to Rosetta shenanigans. If you manage to
260+ # invoke a native shell binary and then a native uname binary, you can
261+ # get the real answer, but that's hard to ensure, so instead we use
262+ # `sysctl` (which doesn't lie) to check for the actual architecture.
263+ if [ " $_cputype " = i386 ]; then
264+ if sysctl hw.optional.x86_64 | grep -q ' : 1' ; then
265+ _cputype=x86_64
266+ fi
267+ elif [ " $_cputype " = x86_64 ]; then
268+ if sysctl hw.optional.arm64 | grep -q ' : 1' ; then
269+ _cputype=arm64
270+ fi
262271 fi
263272 fi
264273
You can’t perform that action at this time.
0 commit comments