8

When I run uname -m in zsh (run via Terminal.app) on my M1 Mac Mini, the output is x86_64, instead of the expected arm64. This is occurring both in zsh and in bash. This is causing issues with installing native ARM wheels with pip, which thinks that I am running an x86 system. I couldn't find any information online about this, and am wondering if it is a bug, or something that I have overlooked. Any ideas of what is going on? Is this expected behavior? I am running macOS 11.3.1. The following other information is output by uname:

uname: Darwin

uname -a: Darwin macmini.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101 x86_64

uname -p: i386

0

3 Answers 3

5

I can reproduce what you are seeing on our Macs on 11.2.3 and 11.3.1 - we get arm64 / arm / arm64 reliably back despite different shells and homebrew (or lack thereof) setups on each.

bmike@mini ~ % sw_vers                 
ProductName:    macOS
ProductVersion: 11.3.1
BuildVersion:   20E241
bmike@mini ~ % /usr/bin/arch
arm64
bmike@mini ~ % /usr/bin/uname -p
arm
bmike@mini ~ % /usr/bin/uname -a
Darwin mini 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101 arm64

Choosing rosetta to run terminal changes this for a stock Mac. Quit and start again terminal.app, and I then get i386 / i386 / x86_64 the same as you reported.

If you look below, you'll see it enabled which will launch a shell that reports what you are seeing as opposed to the results "out of the box" that I showed above.

enter image description here

1
  • 4
    I think you mean "I can NOT reproduce (unless I run Terminal in Rosetta)."..?
    – benwiggy
    May 12, 2021 at 12:24
7

I had a similar problem, which I noticed in attempting to install Homebrew with M1 support. Homebrew's installation script uses uname -m to determine which Homebrew to install, and so was giving me the wrong (Intel) version because it was detecting me as x86_64.

It turns out that my problem was described in this comment

it's not just if running Terminal in Rosetta, but also if whatever process runs the script happens to be running in Rosetta too. If someone runs this in a script deployed by, say, an RMM that is running via Rosetta you'll get x86_64

My problem was that my bash itself was installed by the old Intel Homebrew, and was itself running through Rosetta.

$ file `which bash`
/usr/local/bin/bash: Mach-O 64-bit executable x86_64

I needed to switch to the system bash by running

$ chsh -s /bin/bash

and reconfigure my $PATH such that /bin/bash was preferred. Now uname -m always gives me the expected arm64.

3

I had the same problem without using Rosetta.

It turned out the reason was that I installed homebrew before it had M1 support. Even though I frequently upgrade homebrew, it didn't switch to the Apple Silicon version when it became available.

Reinstalling homebrew solved the issue for me.

1
  • 1
    Good point. Homebrew for ARM needs to be specifically installed, upgrading the Intel version will not migrate it.
    – nohillside
    Oct 19, 2022 at 5:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .