diff --git a/install.sh b/install.sh index 7a06b65..7c206df 100755 --- a/install.sh +++ b/install.sh @@ -65,6 +65,14 @@ is_arch() { command -v pacman >/dev/null 2>&1 } +is_x86_64() { + [ $(uname -m) = "x86_64" ] +} + +is_arm64() { + [ $(uname -m) = "arm64" ] +} + sync_repo() { local repo_uri="$1" local repo_path="$2" @@ -173,6 +181,12 @@ if is_mac && ! command -v brew >/dev/null 2>&1; then # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/Homebrew/install@HEAD/install.sh)" + if is_arm64; then + echo >> $HOME/.zprofile + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi + # Tap cask-upgrade brew tap buo/cask-upgrade diff --git a/install_brew.sh b/install_brew.sh index 3b3d04c..9e9931f 100755 --- a/install_brew.sh +++ b/install_brew.sh @@ -63,6 +63,12 @@ function check { xcode-select --install /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/Homebrew/install@HEAD/install.sh)" + + if is_arm64; then + echo >> $HOME/.zprofile + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi fi }