Apple has release a micro-processor chip called M1. Which is highly compartible to thier computers,, with much better efficiency compared to intel chips. If you have embraced this change, you might find a few difficulty leveraging the new product, due to compatibility issues. Here are the patterns for making the move from Intel to M1.
Homebrew is an open-source package mangaer for macOS, which offers an easy way to install softwares via comand line. It also helps you use commands to download and install Python, Ruby, cask, Nmap, MongDB and other Unix CLI utilities like terraform etc.
- Apple Silion M1 CPU
- macOS Mojave (10.14) or later Command Line tools for Xcode (Some formulae and softwares require Xcode installed)
- Compatible shell for installation (bash or zsh)
- From your Terminal enter this command
$ xcode-select --install
- Follow the instructions from the popup to complete the installation
- Enter the following command in the Terminal:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install)"
- verify your installation by typing
$ brew -v
Rosetta 2 is needed for easy transitioning from Macs running on Intel processors to Apple silicon processors. It allows most intel apps to run on Apple Silicon without issues, enabling software vendors to provide universal updates and builds for both Intel and Aplle Silicon.
- Run the following command to install rosetta 2.
$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
-
If you want to confirm the installation process, copy the shell script in this repo.
-
The script will either enforce the installation, or confirm the installation. Give the shell script execution priviledges
chmod +x install_rosetta_on_apple_silicon.sh
-
Run the shell script in the terminal
./install_rosetta_on_app_silicon.sh
-
the output should be
"Rosetta is already installed and running. Nothing to do."
-
You may need to restart your computer to start seeing the uses of rosseta 2. Enjoy!! :)
-
Some M1 chips have issues installing some apps on M1 chips after installing rosetta 2, if that was your case, please consider the following steps from 8. Note: since the Rosetta emmulated intel processor independently uses /usr/local/ for intel based homebrews, which differs from the /opt/homebrew for M1 chip (ARM64), you may need a seprate homebrew for the rosetta homebrew emulator. You could Either leverage a different terminal (e.g. iterm) for Rosetta related brews, or combining both in same terminal using aliases, this helps in case you forget which terminal is for M1.
-
Combining both in one terminal using the
/usr/local
:
$ arch -x86_64 zsh
$ cd /usr/local && mkdir homebrew
$ curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
After Homebrew is up and running, you can levrage the architecture flags in your installations as Rosetta gives us the ability to prefix commands.
-
Installing the packages using intel, you can use the following:
% arch -x86_64 /usr/local/homebrew/bin/brew install <package name>
-
Installing the packages using intel, you can use the following:
% /opt/homebrew/bin/brew install <package name>
-
To simplify the above, I would rather make use of aliases rather that remembering the above line.
# ~/.zshrc alias ibrew='arch -x86_64 /usr/local/bin/brew' alias mbrew='arch -arm64e /opt/homebrew/bin/brew'
Thus you use
mbrew install <package name>
oribrew install <package name>
-
You can further add the path with preference to M1 version over intel with the following configurations
# ~/.zshrc typeset -U path; path+=(/usr/local/bin); path+=(/opt/homebrew/bin);
-
If you have Python (<3.9), you may encounter some issues, to resolve them run the following:
% arch -x86_64 pip install --upgrade pip setuptools
-
Should you have problems opening Rosetta terminal(shell) run the following:
% arch -x86_64 zsh
Some people have issues installing Terraform on Mac M1. If you have installed Rosetta 2, and restarted your computer, you should not have any issues. But, should you still have issues, run the following command.
% mbrew install --build-from-source terraform