For all native setup, use a native Terminal, iTerm or iTerm2 terminal to install software with native arm64 binary support. In a native terminal, you should get this response from arch
$ arch
arm64
$ uname -m
arm64
- go to Applications and find iTerm or iTerm2 application
- right-click and choose “Duplicate”
- rename the clone to “iTerm-Intel” or “iTerm2-Intel”
- right-click and choose “Get Info”
- Click on the checkbox to “Open Using Rosetta”
- Close the info dialog box and start the intel terminal
If it is not already installed, this could prompt to Rosetta. For more information, see this apple support issue:
All further steps should use the intel-compatible terminal to install additional software. In an intel-compatible terminal, you should get this response from arch
$ arch
i386
$ uname -m
x86_64
To support both arm64
and x86_64
installations, the ZSH init script can be setup to display the
architecture.
# ~/.zshrc file
export SHELL_ARCH="$(uname -m)"
echo "=========== ${SHELL_ARCH} ============"
Use brew to install bash and zsh completion packages. Update ~/.zshrc
to enable completions:
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
autoload -Uz compinit
compinit
fi
Display the architecture (arm64
or x86_64
) of the current shell in your prompt
using Starship. Add this to your ~/.config/starship.toml
:
# ~/.config/starship.toml
[env_var]
variable = "SHELL_ARCH"
style = "bold yellow"
format = "[$env_value]($style) "
On Apple Silicon laptops, VSCode can use rosetta for the integrated terminal.
This can be important for python development to get packages installed with x86_64
binaries.
To create a custom VSCode Terminal Profile for using Rosetta on Apple Silicon, add these settings:
{
"terminal.integrated.profiles.osx": {
"rosetta": {
"path": "arch",
"args": ["-x86_64", "zsh", "-l"],
"overrideName": true
}
},
"terminal.integrated.defaultProfile.osx": "rosetta"
}
You can configure the terminal shell in Preferences | Tools | Terminal
and set the Shell Path:
like so:
env /usr/bin/arch -x86_64 /bin/zsh --login
# ~/.zshrc file
if [ "$(uname -m)" = "x86_64" ]; then
export DOCKER_DEFAULT_PLATFORM=linux/amd64
fi