Apple silicone M1 and similar processors have the ARMv8.4
architecture and rosetta2
to launch native amd64 binaries on the arm64 processor. So apple silicone may launch nearly any app compiled for the Intel platform (there is some exception, for example, the older version of PostgreSQL won't be launched by rosetta2).
By default, homebrew
detects the platform that is installed and tries to find the bottle that is appropriate for arm64. In some cases, there is no bottle for some applications (for example, you can't install openjdk@8
on arm64 because there is no bottle). But you can install, for example, oracle JDK because there is the bottle for arm64 (but it will install amd64 binaries). It is a pretty confusing situation, isn't it?
The decision is to install the second copy of homebrew into the /usr/local/homebrew
directory and launch it in compatibility mode with the command arch -x86_64
. You won't start the original homebrew
with this command because it will lid to mix arm64 and amd64 binaries (and what you will do, if you need the same library for both platforms? libpq as an example).
So there is the step-by-step guide:
- Download homebrew
curl -L https://github.com/Homebrew/brew/tarball/master --output homebrew.tar
- Extract tarball to
/usr/local/homebrew
- chown -R to allow start apps from this folder
- Add aliases to your ~/.zshrc file
# If you come from bash you might have to change your $PATH.
# need this for x86_64 brew
export PATH=$HOME/bin:/usr/local/bin:$PATH
# for intel x86_64 brew
alias axbrew='arch -x86_64 /usr/local/homebrew/bin/brew'
- Now start new console and launch installation, for example
axbrew install openjdk@8
Install other Intel binaries you need the same way. Remember that it will be installed into the /usr/local/homebrew/
directory - fill free to create a symlink if you wanna use it something else.
The slight disadvantage - the java_version
tool won't see the OpenJDK in /user/local directory
, but symlink to /Library/Java/JavaVirtualMachines/
will solve this problem.