Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

UBS28

macrumors 68030
Original poster
Oct 2, 2012
2,893
2,340
How do I force brew to install the ARM64 version instead of the x86 version?

brew install <app_name> doesn't always install the M1 native version while it is available if I check the developer site.
 

UBS28

macrumors 68030
Original poster
Oct 2, 2012
2,893
2,340

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
yep, says arm64.

Is there perhaps a command to "force" the ARM64 version to be installed or is this not possible?
You can force a build from source but as far as I know only matching architectures will be downloaded through the formulas. Do you have an example were that is not the case?
 

white7561

macrumors 6502a
Jun 28, 2016
934
386
World
I'm not an expert in brew. But, since i installed homebrew in arm64 terminal. It always tries to install things in arm64.
 

Fomalhaut

macrumors 68000
Oct 6, 2020
1,993
1,724
How do I force brew to install the ARM64 version instead of the x86 version?

brew install <app_name> doesn't always install the M1 native version while it is available if I check the developer site.
Not sure if you mean install the ARM version of homebrew itself, or ensure the packages are ARM-only?

You can force the architecture with something like "exec arch -arm64 <command>" from the Terminal.

Some relevant info here: https://vineethbharadwaj.medium.com/m1-mac-switching-terminal-between-x86-64-and-arm64-e45f324184d9
 

Gnattu

macrumors 65816
Sep 18, 2020
1,107
1,671
If you are installing a cask, then it might not install the correct version as the arm64 cask may not be available. If it is a bottle then it will always install the arm64 version using arm64 brew.
 

UBS28

macrumors 68030
Original poster
Oct 2, 2012
2,893
2,340
Thanks for all the tips. I am not sure if it was a cask, I will have to double check on that.

Else I will just download the ARM64 version from the website manually.
 
Last edited:

CarbonCycles

macrumors regular
May 15, 2014
122
118
Brew should install the appropriate version for the M1 metal...the part you're going to run into problems is with the casks. Not all the casks or kegs are compiled for native ARM64 execution...if that is the case, the x86 version is installed with Rosetta support.

Running into this problem with my current dev stack...fun times.

Also, just to make sure..you didn't create a new terminal application and checked the "Open using Rosetta". If so, that will pretty much guarantee (from my experience) that you'll be running under x86 intel mode.

Hope that helps!
 

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
Brew should install the appropriate version for the M1 metal...the part you're going to run into problems is with the casks. Not all the casks or kegs are compiled for native ARM64 execution...if that is the case, the x86 version is installed with Rosetta support.

Running into this problem with my current dev stack...fun times.

Also, just to make sure..you didn't create a new terminal application and checked the "Open using Rosetta". If so, that will pretty much guarantee (from my experience) that you'll be running under x86 intel mode.

Hope that helps!
Isn’t everything on brew.sh open source? Can’t you download the project and compile it for Arm?
 

CarbonCycles

macrumors regular
May 15, 2014
122
118
Isn’t everything on brew.sh open source? Can’t you download the project and compile it for Arm?
Umm without going into a long and boring discussion on software development and compiling for different architectures, the answer is a hypothetical "Yes" but in reality a "Not really worth the effort" with lots of caveats.
 
  • Like
Reactions: hwojtek

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
Umm without going into a long and boring discussion on software development and compiling for different architectures, the answer is a hypothetical "Yes" but in reality a "Not really worth the effort" with lots of caveats.
Got it. For anything I really need that runs a lot of the time I would make the effort but a lot of stuff will run only occasionally and the Rosetta version is fine.

I would also check to see if the project has a built Aarch64 binary that just hasn’t been released yet. That is low effort. Eclipse is currently like that (last time I checked).
 

CarbonCycles

macrumors regular
May 15, 2014
122
118
If you really insist on trying to get brew to install your arm compiled package...try this (taken from slashdot):
  1. Go to the Homebrew Cask search page: https://formulae.brew.sh/cask/
  2. Type and find the application you are looking for
  3. Click Cask code link
  4. On Github click History button
  5. Find the version you need by reading the commit messages and view the raw file. Confirm the version variable (normally on line 2) is the version you need.
  6. Click on the name of the commit, then three dots and select View file
  7. Right-click Raw button and Save Link As... to download the file locally
  8. When downloaded, go to download directory cd Downloads/
  9. Finally run brew install --cask <FORMULA_NAME>.rb
Or you can just download the arm64 (assuming it exists), save to local, and then run $brew install ....
 

N4LYD

macrumors newbie
May 3, 2021
18
8
When I did the user migration from my x86 mac to my M1, I found that the x86 homebrew was migrated over. I found that just installing the ARM homebrew wasn't a great way to go (it didn't automatically update to M1 versions, etc.), so I completely removed homebrew and started over. That has worked out well, and I think I'd recommend it for anyone making the migration to M1 from x86.
 
  • Like
Reactions: jdb8167

jdb8167

macrumors 601
Nov 17, 2008
4,859
4,599
I thought what you install with "brew install" is open-source, but not what you install with "brew install --cask". Am I wrong?
No idea. I think you can install any application with a cask but I don't know if the brew project will let you publish the cask.
 

haralds

macrumors 68030
Jan 3, 2014
2,990
1,252
Silicon Valley, CA
When I did the user migration from my x86 mac to my M1, I found that the x86 homebrew was migrated over. I found that just installing the ARM homebrew wasn't a great way to go (it didn't automatically update to M1 versions, etc.), so I completely removed homebrew and started over. That has worked out well, and I think I'd recommend it for anyone making the migration to M1 from x86.
Brew x86_64 is installed and migrated to /usr/local. The AMR64 version is installed in /opt/homebrew.
Most every package has been ported by now. After migration I would uninstall the old x86 homebrew and install the new.
I have both with the x86 version aliased as iBrew. But as all packages are migrated there is nothing installed there and I will likely get rid of it in my next housecleaning.
 

CarbonCycles

macrumors regular
May 15, 2014
122
118
Brew x86_64 is installed and migrated to /usr/local. The AMR64 version is installed in /opt/homebrew.
Most every package has been ported by now. After migration I would uninstall the old x86 homebrew and install the new.
I have both with the x86 version aliased as iBrew. But as all packages are migrated there is nothing installed there and I will likely get rid of it in my next housecleaning.
That is a misleading statement...many of the casks/kegs have not been ported over to ARM64. I run into this problem consistently...it will be a while before there is full support for ARM (it's getting there...slowly).

I think ppl are convoluting what is brew. it is a simple package manager/installer (in very general terms). It has very little to do with the program that it is trying to install...it facilitates the installation and tries to keep track of all the files so that when you uninstall or need to replicate environments it makes it pretty self contained. The actual program you're trying to install has to be natively compiled for ARM64, or it will install x86 and use Rosetta2 for the translation layer.

You can bring up Activity Monitor and see which programs run natively on Apple or is using the Intel instruction set to prove it for yourself.

Btw, I wish apple would stop messing around w/ the local installation directories. Kinda causes havoc when you have your tools all set-up an then...no bueno.
 
  • Like
Reactions: Lihp8270

dgdosen

macrumors 68030
Dec 13, 2003
2,817
1,463
Seattle
It's been a while since I had both x86_64 and arm64 versions of brew installed (I haven't needed the x86_64 version of anything in months...)

But even though you may be running an arm64 terminal session, you should also have your path pointing to the arm64 homebrew. If your x86_64 homebrew is in the path, or sooner in the path, brew will install/use the x86_64 version under rosetta. (won't it?)

I load up different dotfiles and paths depending on the results of `uname` (Darwin/Linux) or `uname -a` (arm64/x86_64)
 

leman

macrumors Core
Oct 14, 2008
19,521
19,678
Btw, I wish apple would stop messing around w/ the local installation directories. Kinda causes havoc when you have your tools all set-up an then...no bueno.

What exactly do they mess with? Can't say I ever had any issues here? From what I've seen they follow UNIX guidelines quite precisely?
 

CarbonCycles

macrumors regular
May 15, 2014
122
118
What exactly do they mess with? Can't say I ever had any issues here? From what I've seen they follow UNIX guidelines quite precisely?
Forcing the use of /opt/... from /usr/local. Security and permissions that require a day hunting down what new policies they have implemented. The fun dev/ops stuff that really just burns a day with a ton of searching and trials.
 

leman

macrumors Core
Oct 14, 2008
19,521
19,678
Forcing the use of /opt/... from /usr/local. Security and permissions that require a day hunting down what new policies they have implemented. The fun dev/ops stuff that really just burns a day with a ton of searching and trials.

Huch, how did they force it? If I remember it correctly this decision was made solely by brew maintainers because a) they needed a different folder for ARM vs x86 brew and b) they wanted to fix long-standing problem regarding conflicts with unbrewed software in usr/local. IMO I would have preferred them to keep brew in local but the choice has been made…
 
  • Like
Reactions: N4LYD

CarbonCycles

macrumors regular
May 15, 2014
122
118
Huch, how did they force it? If I remember it correctly this decision was made solely by brew maintainers because a) they needed a different folder for ARM vs x86 brew and b) they wanted to fix long-standing problem regarding conflicts with unbrewed software in usr/local. IMO I would have preferred them to keep brew in local but the choice has been made…
I think it was forced because of the stricter security posture Apple took...I know of many other applications that had to make the migration from /usr/local to /opt. I recall pretty vividly when we took ownership of the new 15" MBPs (at that time) and having to find out what was causing things to break only to go back to Apple's change in philosophy.

I can't fault Apple's decision to keep their ecosystem safe from (un)intentional malicious activities.
 

leman

macrumors Core
Oct 14, 2008
19,521
19,678
I think it was forced because of the stricter security posture Apple took...

I don't think this explanation makes much sense? After all, "old" x86 one works just fine under /usr/local on the same OS and machine.

P.S. Found a discussion on this with comments from a homebrew maintainer: https://www.reddit.com/r/MacOS/comments/jw9guu As I thought, this is 100% deliberate decision of the homebrew team.
 
  • Like
Reactions: Xiao_Xi
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.