Skip to content

Instantly share code, notes, and snippets.

@meska
Forked from Molin-L/install_homebrew_m1.sh
Created May 11, 2022 15:22
Show Gist options
  • Save meska/0e6be87b0e351c6bf3a9ad67efcf2304 to your computer and use it in GitHub Desktop.
Save meska/0e6be87b0e351c6bf3a9ad67efcf2304 to your computer and use it in GitHub Desktop.
Install Homebrew on Apple silicon device/M1.
# Install ARM Homebrew to /opt/homebrew
# 安装ARM版本的Homebrew 到 /opt/homebrew
mkdir /opt/homebrew
sudo chown -R $(whoami) /opt/homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /opt/homebrew
# Install x86 Homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Set alias for different homebrew
echo "alias abrew=\"/opt/homebrew/bin/brew\"" >> ~/.zshrc # ARM Homebrew
echo "alias ibrew=\"arch -x86_64 /usr/local/bin/brew\"" >> ~/.zshrc # X86 Homebrew
echo "export PATH=\"/opt/homebrew/bin:$PATH\"" >> ~/.zshrc
echo "Try \'abrew\' to run ARM Homebrew, and \'ibrew\' to run x86 Homebrew"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment