Skip to content
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

How to consider processor architecture when installing? #1229

Closed
nhooey opened this issue Jul 13, 2023 · 5 comments
Closed

How to consider processor architecture when installing? #1229

nhooey opened this issue Jul 13, 2023 · 5 comments
Labels

Comments

@nhooey
Copy link

nhooey commented Jul 13, 2023

Sometimes it's necessary to know which app to install based on the system architecture:

Example from my own Ansible YAML: Which battery app to install:

  - name: zackelia/formulae/bclm             # Wrapper to read and write Battery Charge Level Max (BCLM) Run: sudo bclm write 80
    arch: x86_64
  - name: aldente                            # Prevents full battery charging on Apple Silicon
    arch: arm64

Is there a way to do this with homebrew-bundle?

@colindean
Copy link
Member

Many if not most if not nearly all formulae and casks handle this. Homebrew Bundle just tells Homebrew what formulae and casks and whatnot to install. Those will then install the correct version for the architecture.

If you find this is not the case, double-check the formula/cask and then upstream to be sure that the software supports your architecture.

@nhooey
Copy link
Author

nhooey commented Jul 13, 2023

In this case each app only supports a single architecture, and naively trying to install one on the wrong architecture will make Homebrew fail.

I'm not sure what will happen in homebrew-bundle's case.

But you could just evaluate the output of uname -m to make sure it's arm64 or x86_64, it seems.

@jacobbednarz
Copy link
Member

as @colindean mentioned, this isn't something homebrew-bundle handles but offloads to the formula/cask. if you're seeing issues, the best place to investigate is the formula.

@jacobbednarz jacobbednarz closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2023
@colindean
Copy link
Member

I see what you're trying to do now, sorry about that.

You can use Hardware::CPU.arm? and Hardware::CPU.intel? but n.b. these are not explicitly part of the Brewfile DSL so they're not guaranteed to work perpetually— they probably will for the foreseeable future.

I use this several of my own Brewfiles:

if OS.mac? && Hardware::CPU.arm?
  # OS-level dependency for pyodbc
  brew "unixodbc"
end

N.b. that the AlDente FAQ lists support for Intel Macs under the Is my MacBook Model supported? section and the DMG for v1.22 ships a universal binary.

@MikeMcQuaid
Copy link
Member

You can use Hardware::CPU.arm? and Hardware::CPU.intel? but n.b. these are not explicitly part of the Brewfile DSL so they're not guaranteed to work perpetually— they probably will for the foreseeable future.

Yes, this is the best bet, I'd rely on this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants