Last active
April 12, 2024 09:27
-
-
Save kategray/7fa464098da16ac42c7b4fe129f79202 to your computer and use it in GitHub Desktop.
M1 dual homebrew (x86_64 and arm64) setup
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
# | |
# .zshrc for Mac M1 chips to handle both x86_64 and arm64 homebrew | |
# | |
# Be sure to remove .zprofile in order to prevent invalid paths, and | |
# remove /usr/local/bin from /etc/paths. | |
# | |
# Install both arch homebrew versions with: | |
# arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
alias ishell="arch -x86_64 /bin/zsh" | |
alias ashell="arch -arm64 /bin/zsh" | |
arch_name="$(uname -m)" | |
# Reset the paths | |
if [ -x /usr/libexec/path_helper ]; then | |
unset PATH | |
eval `/usr/libexec/path_helper -s` | |
fi | |
if [ "${arch_name}" = "x86_64" ]; then | |
eval "$(/usr/local/bin/brew shellenv)" | |
if [ "$(sysctl -in sysctl.proc_translated)" = "1" ]; then | |
echo "Running on Rosetta 2" | |
else | |
echo "Running on native Intel" | |
fi | |
elif [ "${arch_name}" = "arm64" ]; then | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
echo "Running on ARM" | |
else | |
echo "Unknown architecture: ${arch_name}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment