How to Install Homebrew on Mac M1

Homebrew is a free and open-source software package manager for Mac and Linux, It simplifies the installation of the programs on Apple’s Operating System Mac OS and as well as on Linux. Homebrew is now officially available for ARM-based Mac computers; it means you will be able to install homebrew natively on Mac M1 computers. This guide will walk you through how to install Homebrew on Mac M1.

You can either install Homebrew natively on Mac M1 or install under the Rosetta emulation. In this guide, we will share both ways.

Install Homebrew natively on Mac M1

Before you proceed to installation make sure the Terminal is not running using Rosetta. To check, hold down the command key, then click the Terminal in the Dock; this will take you to the application folder. Right-click the Terminal and select the Get info option. In the Terminal info, uncheck the option called “Open using Rosetta” if it’s checked.

Installing the Homebrew on Mac M1 is relatively easy; you have to run a simple script on Terminal. That’s it; after some time, Homebrew will be available on your computer.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the on-screen instruction to complete the installation. The installation will be completed into /opt/homebrew directory.

If the installation was successful, then congratulations; if not, now you can install under Rosetta emulation.

Install Homebrew under Rosetta on Mac M1

Before you proceed to the installation, make sure Terminal is running under Rosetta. To make sure you can check the Terminal info.

You may need to install some packages that are not currently available for ARM 64 based Mac M1. That’s why you may need to install Homebrew under Rosetta to compile the packages into x86_64.

The installation is pretty straightforward. You have to run exactly the same script that is available to install Homebrew natively on Mac. Copy the following script and run on the Terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the on-screen instruction to complete the installation of Homebrew on Mac M1. The installation will be completed into /usr/local directory.

If the installation doesn’t successful and you get the error like the following one.

error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Now abort the installation by hitting the Ctrl+C key, then run the command brew update –force –verbose in the Terminal.

This command will complete the installation of the homebrew-core library under the usr/local/Homebrew/Library/Taps/homebrew/ directory.

How to uninstall Homebrew on Mac M1

As easy as was the installation, uninstallation is also relatively easy like that. You have to run a simple script in the Terminal. That’s it, and the uninstallation will complete in seconds.

Before you proceed to uninstallation, check the Terminal whether it’s running under Rosetta. It doesn’t matter you have installed Homebrew natively or using Rosetta, the uninstallation script is one.

Copy the following script and run on the Terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Follow the on-screen instructions to complete the uninstallation of Homebrew on Mac M1. When running the script, be sure in which directory Homebrew was installed because this script will remove the directory.

If you need for information, follow this link – https://github.com/homebrew/install

I hope Homebrew has successfully installed on your Mac M1 computer. If you any any question, feel free to comment below.

3 thoughts on “How to Install Homebrew on Mac M1”

  1. Bawantha Rajapaksha

    how you can type brew update –force –verbose if brew is not installed ? zsh: command not found: brew

  2. This thing keeps on downloading for ever!!! I always feel Homebrew is really heavy and install bunch of thousand things just to install one package!

Leave your reply here

Scroll to Top