iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🍎
Separating Homebrew settings for M1 and Intel processors
The Issue
I bought a Mac equipped with an M1 processor, but since I also work on a Mac with an Intel processor, the settings shared between both resulted in errors.
Solution
I addressed this by branching the configuration based on the differences in CPU architecture.
Homebrew
The following example is a configuration file for fish, but you should be able to adapt it for other shells as well.
$HOME/.config/fish/config.fish
switch (uname -m)
case x86_64
set HOMEBREW_DIR /usr/local
case arm64
set HOMEBREW_DIR /opt/homebrew
end
# Homebrew
set -U fish_user_paths "$HOMEBREW_DIR/bin" $fish_user_paths
asdf
Also, since I use asdf to manage language runtime versions, I configured that in a similar way.
$HOME/.config/fish/config.fish
# asdf
source "$HOMEBREW_DIR/opt/asdf/asdf.fish"
Discussion
brew --prefix を使うとインストールPATHが表示されるのでそれを使うことで分岐無しでシンプルになりそうです。どうでしょうか。
おお、ありがとうございます!