Install roseta
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Create following aliase in .zshrc
alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"
alias intel="env /usr/bin/arch -x86_64 /bin/zsh --login"
Then use
$ arm
$ intel
To have 2 different nvms installed with 2 different node (arm and x86) Have to run this in two differetn (arm and intel) terminals /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" after this and adding the lines below we will have two independent brew intalations :-)
alias intel="env /usr/bin/arch -x86_64 /bin/zsh --login"
alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"
if [ "$(arch)" = "i386" ]; then
local brew_path="/usr/local/homebrew/bin"
local brew_opt_path="/usr/local/opt"
local nvm_path="$HOME/.nvm-x86"
local tmpdir=/tmp/x86tmp
else
local brew_path="/opt/homebrew/bin"
local brew_opt_path="/opt/homebrew/opt"
local nvm_path="$HOME/.nvm-arm"
local tmpdir=/tmp/arm64tmp
fi
export PATH="${brew_path}:${PATH}"
export NVM_DIR="${nvm_path}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
If yarn does not run (no output) follow advide from here https://stackoverflow.com/questions/77114874/the-yarn-command-has-no-output
I fixed this by going to $TMPDIR and removing any directories with ‘v8’ in the name:
cd $TMPDIR ls | grep v8 | xargs rm -rf yarn will read from cache directories in $TMPDIR. Directories will be named something like v8-compile-cache-501. The cache directories were likely made for x86_64, and when the migration tool ran, yarn still reads from the cache directory but doesn’t know its for the wrong ISA (since new laptop uses arm64). Hope this helps others running into the same problem!
rm -rf $TMPDIR/v8-compile-cache-501