zsh-brew-switcher
October 6, 2023 ยท View on GitHub
Automatically switch between Homebrew installations based on the current active arch, arm64 or x86_64, on Apple Silicon Macs.

๐ฆ Installation
Install with your zsh plugin manager of choice.
with zplug
zplug fielding/zsh-brew-switcher, from:github, at:main
๐ Usage
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.
Extra
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
๐บ Homebrew Paths
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.
๐ค Contributing
Pull requests are welcome! Feel free to open an issue for bugs or feature requests.
Inspiration
This plugin was inspired by https://www.applegamingwiki.com/wiki/Game_Porting_Toolkit! Thanks :heart: