File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -255,10 +255,19 @@ get_architecture() {
255
255
fi
256
256
fi
257
257
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
262
271
fi
263
272
fi
264
273
You can’t perform that action at this time.
0 commit comments