- Uninstall all previous installation and its dependencies, e.g. ant, Java,..
brew remove java
brew remove ant
brew remove zlib
# python, etc
remove homebrew last
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew
Note Finalling removing homebrew if you installed them in M1/M2 i.e. via arm64 (default)
- run the following command to install Rosetta (which is an emulator, that converts M1/M2 to x86_64)
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
- add the following to your .bashrc and source the file
#!/usr/bin/env bash
export PATH="/usr/bin:/usr/local/bin:$PATH"
# GIT FUNCTIONS
git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# TERMINAL PROMPT
get_m1_ps1() {
echo "\[\e[0;92m\]\$(git_branch)\[\e[m\] \n\[\e[0;93m\](m1) \u\[\e[m\] \[\e[0;95m\]\W\[\e[m\] >> "
}
get_intel_ps1() {
echo "\[\e[0;92m\]\$(git_branch)\[\e[m\] \n\[\e[0;93m\](intel) \u\[\e[m\] \[\e[0;95m\]\W\[\e[m\] >> "
}
get_amd_ps1() {
echo "\[\e[0;92m\]\$(git_branch)\[\e[m\] \n\[\e[0;93m\](amd64) \u\[\e[m\] \[\e[0;95m\]\W\[\e[m\] >> "
}
case $(uname -m) in
x86_64) PS1=$(get_intel_ps1) ;;
arm64) PS1=$(get_m1_ps1) ;;
esac
export PS1=$PS1
# arch
alias arm="env /usr/bin/arch -arm64 /bin/bash --login"
alias intel="env /usr/bin/arch -x86_64 /bin/bash --login"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
- Switch to the x86_64 or arm64 architecture by running the following in the terminal
intel # x86_64
arm # arm64
-
Install homebrew from https://brew.sh/
-
Run the following command
brew install openssl readline sqlite3 xz zlib tcl-tk
- Add the following to .bashrc and source it
export PATH="/usr/local/opt/openssl@3/bin:$PATH"
export LDFLAGS+=" -L/usr/local/opt/openssl@3/lib"
export CPPFLAGS+=" -I/usr/local/opt/openssl@3/include"
export CFLAGS+=" -I/usr/local/opt/openssl@3/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
export LDFLAGS+=" -L/usr/local/opt/readline/lib"
export CPPFLAGS+=" -I/usr/local/opt/readline/include"
export CFLAGS+=" -I/usr/local/opt/readline/include"
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS+=" -L/usr/local/opt/sqlite/lib"
export CPPFLAGS+=" -I/usr/local/opt/sqlite/include"
export CFLAGS+=" -I/usr/local/opt/sqlite/include"
export LDFLAGS+=" -L/usr/local/opt/zlib/lib"
export CPPFLAGS+=" -I/usr/local/opt/zlib/include"
export CFLAGS+=" -I/usr/local/opt/zlib/include"
export PATH="/usr/local/opt/tcl-tk/bin:$PATH"
export LDFLAGS+=" -L/usr/local/opt/tcl-tk/lib"
export CPPFLAGS+=" -I/usr/local/opt/tcl-tk/include"
export CFLAGS+=" -I/usr/local/opt/tcl-tk/include"
- Install pyenv using brew:
brew install pyenv
- Add following to .bash_profile and source it
# # Pyenv python
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/shims:$PATH"
eval "$(pyenv init -)"
- Install python using pyenv, and verify cryptography install
pyenv install 3.8.9 --verbose
pyenv versions
pyenv global 3.8.9
pip install --upgrade pip
pip install wheel setuptools
pip install cryptography
- Install Java11
brew install java11
# Verify that JavaVirtualMachines folder exist in
ls /Library/Java
# then run
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
- Add the following to your .bashrc and source it
export PATH="/usr/local/opt/openjdk@11/bin:$PATH"
export CPPFLAGS+=" -I/usr/local/opt/openjdk@11/include"
export CFLAGS+=" -I/usr/local/opt/openjdk@11/include"
export JAVA_HOME="/usr/local/opt/openjdk@11"
- run the following command
brew install [email protected]
then add the following to you .bashrc and source it
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
In Explore goto Application Folder, Right click on terminal and click on Get info Under Copyright: you need to tick "Open using Rosetta"
Now close and open terminal and its done. Now you can use your Mac M1/M2 as a Intel. I hope you wont be facing issues while installing any Applications. Hurray!