Can I install arm64 libraries on x86_64 with homebrew?

Viewed 1199

I am cross-compiling on x86_64 MacOS 11 for arm64 architecture. clang/XCode support it but I face an issue when external library is required. Let it be boost, for example. I know that the bottle for arm64 is available but it looks like there is no way to select it for installation.

arch -arm64 brew ... says that this architecture is unknown which sounds fair.

So the question is wheather there is an option to force brew install bottles for 'foreign' architecture ?

1 Answers

Thanks to Homebrew team https://github.com/Homebrew/discussions/discussions/2843

I made it work with the code like this:

setopt sh_word_split
mkdir arm-homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew 
alias arm-brew='$(pwd)/arm-homebrew/bin/brew'
response=$(arm-brew fetch --force --bottle-tag=arm64_big_sur boost | grep "Downloaded to")
parsed=($response)  
arm-brew install $parsed[3] 
Related