-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPU: add ability to check for Rosetta #7995
Conversation
bc41b39
to
9a74223
Compare
I think it would make sense to move the Linux-specific code to instead be in the generic OS case (Library/Homebrew/hardware.rb) and override on macOS only. |
9a74223
to
9dc001b
Compare
Good call, done |
9dc001b
to
f6a5c84
Compare
f6a5c84
to
bb0a39e
Compare
Simplified the patch slightly with a macOS-only ARM64 helper method. In the future we'll likely be able to go without that if we can check for Rosetta directly instead of indirectly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Wouldn't checking for https://developer.apple.com/documentation/apple_silicon/about_the_rosetta_translation_environment |
When we last checked, |
When running within an Intel terminal, `uname -m` and friends return Intel-based values for compatibility. An Intel shell will also prefer to launch Intel slices of programs unless the program is ARM-only. It's an open question how Homebrew should manage running in Intel mode. Should it continue to behave as though the Mac is Intel-based, like it does now? Should it recognize it's ARM-based? Either way, it's useful for us to be able to tell whether the Mac is running under Rosetta or whether it's a real Intel Mac.
65b248f
to
74d3f0b
Compare
@mistydemeo Thanks for this! |
Following on from #1237, with new discoveries! Turns out that in many cases, Apple Silicon Macs will in fact run Bash in amd64 mode, which in turn means the reported architecture is amd64, even though it's an Apple Silicon Mac. Homebrew has worked around this in Homebrew/brew#7995, and we more or less follow their lead here. This makes it so that we _always_ show our little notice on Apple Silicon Macs, whether their shell is in amd64 or arm64 mode.
btw, seems that it works now:
|
brew style
with your changes locally?brew tests
with your changes locally?When running within an Intel terminal,
uname -m
and friends return Intel-based values for compatibility. An Intel shell will also prefer to launch Intel slices of programs unless the program is ARM-only.It's an open question how Homebrew should manage running in Intel mode. Should it continue to behave as though the Mac is Intel-based, like it does now? Should it recognize it's ARM-based? Either way, it's useful for us to be able to tell whether the Mac is running under Rosetta or whether it's a real Intel Mac.