Display the architecture (arm64
or x86
) of the current shell in your prompt using Starship. I use zsh as my shell but you should be able to adapt this for other shells. As a bonus this also shows you how to set up your path to work with both arm64 and x86 versions of Homebrew.
Add this to your ~/.zshrc
:
if [[ $(arch) == 'arm64' ]]; then
export PATH="$HOME/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export SHELL_ARCH="arm64"
echo '=========== arm64 ============'
else
export PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH"
export SHELL_ARCH="x86"
echo '============ x86 ============='
fi
Add this to your ~/.config/starship.toml
:
[env_var]
variable = "SHELL_ARCH"
style = "bold yellow"
format = "[$env_value]($style) "