Skip to content

Instantly share code, notes, and snippets.

@kiding

kiding/install.sh

Last active Mar 4, 2021
Embed
What would you like to do?
Heterogeneous Homebrew: Apple Silicon & Intel Rosetta 2 side-by-side
# Install Homebrew at /opt/homebrew (for Apple Silicon)
arch -arm64e /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Homebrew at /usr/local (for Intel Rosetta 2)
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add these lines to ~/.zshrc
alias za="arch -arch arm64e /bin/zsh"
alias zi="arch -arch x86_64 /bin/zsh"
if [[ $(arch) == "arm64" ]]; then
PS1="%{$fg_bold[red]%}🐇%{$reset_color%} $PS1"
PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
else
PS1="%{$fg_bold[red]%}🐢%{$reset_color%} $PS1"
PATH="/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
fi
# Usage
# - Run `za` to switch to Apple Silicon shell & Homebrew
# - Run `zi` to switch to Intel Rosetta 2 shell & Homewbrew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment