Last active
February 16, 2022 18:50
-
-
Save josephschmitt/6f426db08440c5c9589ec0cbf420a2a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# $ switch_brew (uname -m) | |
# $ switch_brew x86_64 | |
# $ switch_brew arm64 | |
function switch_brew | |
set -l arm_brew_path "/opt/homebrew/bin" | |
set -l switch_to $argv[1] | |
if test "$switch_to" = "x86_64" | |
if set -l index (contains -i $arm_brew_path $PATH) | |
set -e PATH[$index] | |
end | |
else if test "$switch_to" = "arm64" | |
set PATH $arm_brew_path $PATH | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This file should be added to
~/.config/fish/functions/switch_brew.fish
. Then add this line to your~/.config/fish/config.fish
file to automatically set the correct brew on startup:See homebrew's installation instructions for more context, or this explanation.
Additionally, this blog post goes into more explanation on the multi-brew setup.