The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Installing Homebrew on a M2 MacBook Air from 2022

posted on 27.6.2023 by Below Surface in "MacOS"

To install packages like NPM on MacOS, Homebrew is a well working tool. However I faced some issues on my M2 MacBook Air from 2022. This is how I solved it.

First install Homebrew:

/bin/bash -c "$(curl -fsSL"

Usually, it should be possible to run brew commands now, but this error may appear:

zsh: command not found: brew

If Homebrew was installed successful, the next solution may be, to add two lines to the bottom of the zshrc file:

cd /etc
cp zshrc zshrc_backup // create a backup file, if you mess up the original one
sudo nano zshrc

Add these two lines at the bottom of the file:

export PATH=/opt/homebrew/bin:$PATH
export PATH=/opt/homebrew/sbin:$PATH

Hit ctrl + o and then enter to save. Then Hit ctrl + x to exit the editor. A system restart may be necessary!

Please check the provided sources for more information. Links below.




More posts of this category

Manually remove iOS backups from a mac computer

How to locate and remove iOS backups from a mac


How to create a shortcut file to run bash commands

Need to connect to a server with SSH frequently? Here is how to do it!


Recovery Mode shortcut for a 2012 MacBook Pro

Use this keyboard shortcut to boot into recovery mode