Automatically switch between Homebrew installations based on the current active arch, arm64 or x86_64, on Apple Silicon Macs.
Install with your zsh plugin manager of choice.
with zplug
zplug fielding/zsh-brew-switcher, from:github, at:main
Simply run a zsh shell with a specified architecture the plugin will automatically switch to the correct brew installation for you based on the arch, $(arch)
, specified.
I planned to make a plugin to enable viewing the arch when it was x86_64 in a spaceship prompt, but somebody took care of it already. I recommend using these together, spaceship-arch
On ARM64, Homebrew is installed to /opt/homebrew
and the executable path is /opt/homebrew/bin/brew
.
On X86_64, Homebrew is installed to /usr/local/Homebrew
and the executable path is /usr/local/bin/brew
.
The plugin handles running brew shellenv
from the correct brew executable automatically based on the specified architecture.
Pull requests are welcome! Feel free to open an issue for bugs or feature requests.
This plugin was inspired by https://www.applegamingwiki.com/wiki/Game_Porting_Toolkit! Thanks ❤️