Finally got around to setting up an x86 instance of Homebrew via Rosetta to install x86 Racket. Here's all the steps I took.
First, ensure Rosetta 2 is installed:
$ /usr/sbin/softwareupdate --install-rosetta
Then install x86-64 Homebrew. However, I've also kept the regular Apple Silicon Homebrew. Turns out they require different path prefixes anyway, so the regular one is at /opt/homebrew
while the x86 one is at /usr/loca/homebrew
. To install the x86 one, I did:
$ mkdir /tmp/homebrew
$ curl -L https://github.com/Homebrew/brew/tarball/master | tar xz -C /tmp/homebrew --strip-components=1 --
$ sudo mv /tmp/homebrew /usr/local/
I then updated my $PATH
definitions so that the x86 version's bin
directory has lower precedence than the Apple Silicon version's, and also created an alias so that I can still easily access the brew
binary via brew64
(this is in my ~/.zprofile
):
# If the x86-64 Homebrew path is found, include it first.
[[ ! -d /usr/local/homebrew ]] || {
alias brew64="arch -x86_64 /usr/local/homebrew/bin/brew"
export PATH="/usr/local/homebrew/bin:$PATH"
}
[[ ! -d /opt/homebrew ]] || export PATH="/opt/homebrew/bin:$PATH"
Now I can open a new (regular) terminal, and from the shell I can do type -a brew64
to see:
$ type -a brew64
brew64 is an alias for arch -x86_64 /usr/local/homebrew/bin/brew
With this, I can install nasm
and Racket:
$ brew64 install nasm
$ brew64 install --cask racket
And I can confirm the x86 versions were installed:
$ file /usr/local/homebrew/bin/nasm
/usr/local/homebrew/bin/nasm: Mach-O 64-bit executable x86_64
$ file /usr/local/homebrew/bin/racket
/usr/local/homebrew/bin/racket: Mach-O 64-bit executable x86_64