Programming

How to install homebrew on M1 mac

19 September 2026 · 9 min read

How to install homebrew on M1 mac

Are you a proud owner of a shiny new M1 Mac and eager to unleash its full potential with powerful command-line tools? Then you’ve likely heard of Homebrew, the popular package manager that simplifies software installation on macOS. While the transition to Apple Silicon has been largely seamless, installing Homebrew on an M1 Mac requires a slightly different approach than on Intel-based Macs. This guide will walk you through the process of how to install Homebrew on M1 Mac, ensuring a smooth and successful setup. We’ll cover everything from installing Rosetta 2 (if needed) to verifying your installation and troubleshooting common issues. Get ready to equip your M1 Mac with the tools you need to become a command-line master.

Understanding Homebrew and the M1 Architecture

Homebrew is essentially a software installation wizard for macOS. It allows you to easily install a vast library of open-source software, command-line tools, and other utilities directly from your terminal. Think of it as the App Store, but for developers and power users. Traditionally, Homebrew was designed for Intel-based Macs. However, with the advent of Apple’s M1 chips, a new architecture was introduced, necessitating some adjustments to the installation process. Understanding this difference is key to avoiding potential issues and ensuring optimal performance.

The M1 chip uses an ARM-based architecture, which differs significantly from the Intel x86 architecture that older Macs use. This means that some software needs to be recompiled to run natively on M1 Macs. Homebrew handles this by offering both native M1 support and the ability to run Intel-based software through Rosetta 2, Apple’s binary translation technology. By default, Homebrew will install packages optimized for the M1 architecture whenever available, providing the best possible performance. However, some older or less frequently updated packages may still require Rosetta 2.

Before proceeding with the installation, it’s important to understand the implications of using Rosetta 2. While it allows you to run Intel-based software, it can come with a slight performance overhead. Therefore, it’s generally recommended to use native M1-optimized packages whenever possible. However, if you encounter software that requires Rosetta 2, it’s a valuable tool to have. Let’s move on to the installation steps, ensuring you have everything you need for a successful setup.

Step-by-Step Guide to Installing Homebrew on M1 Mac

The installation process for Homebrew on an M1 Mac is straightforward, but it’s crucial to follow each step carefully to avoid errors. Before you begin, make sure you have administrator privileges on your Mac, as you’ll need to enter your password during the installation. Also, ensure you have a stable internet connection, as Homebrew will need to download files from the internet.

Here’s a step-by-step guide:

  1. Install Rosetta 2 (if needed): Open Terminal and run the following command: softwareupdate --install-rosetta. If Rosetta 2 is already installed, you’ll see a message indicating that. If not, follow the prompts to install it.
  2. Open Terminal: Launch the Terminal application. You can find it in /Applications/Utilities.
  3. Install Homebrew: Paste the following command into the Terminal window and press Enter: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" This command downloads and executes the official Homebrew installation script.
  4. Follow the Prompts: The installation script will guide you through the process. You’ll be prompted to enter your password to grant necessary permissions. Pay close attention to the instructions and press Enter when prompted.
  5. Add Homebrew to your PATH: After the installation is complete, the script will provide instructions on how to add Homebrew to your PATH. This allows you to run Homebrew commands from any directory in the Terminal. Typically, this involves adding a line to your .zshrc or .bash_profile file. The script will provide the exact command to use, which usually looks something like: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc followed by eval "$(/opt/homebrew/bin/brew shellenv)".
  6. Verify the Installation: After adding Homebrew to your PATH, close and reopen the Terminal window. Then, run the command brew doctor. This command checks your system for potential problems and provides suggestions for fixing them. Address any issues reported by brew doctor before proceeding.

Following these steps carefully will ensure a successful Homebrew installation on your M1 Mac. Now that you have Homebrew installed, let’s explore some common use cases and how to manage packages.

Managing Packages with Homebrew

Once Homebrew is successfully installed, you can start using it to install and manage software packages. Homebrew provides a simple and consistent interface for installing, updating, and uninstalling software. Here’s a quick overview of some common Homebrew commands:

  • brew install [package_name]: Installs the specified package. For example, to install Git, you would run brew install git.
  • brew update: Updates the Homebrew package list, ensuring you have the latest versions available.
  • brew upgrade: Upgrades all installed packages to their latest versions.
  • brew uninstall [package_name]: Uninstalls the specified package. For example, to uninstall Git, you would run brew uninstall git.
  • brew search [package_name]: Searches for a package in the Homebrew repository.
  • brew list: Lists all installed packages.

Homebrew also provides commands for managing dependencies, cleaning up old versions, and performing other maintenance tasks. The brew cleanup command removes old versions of packages, freeing up disk space. The brew deps [package_name] command shows the dependencies of a particular package. These commands are essential for keeping your Homebrew installation clean and efficient.

Here is a featured snippet example: To check the health of your Homebrew installation and identify potential issues, use the command brew doctor. This command performs a series of checks and provides recommendations for resolving any problems it finds, ensuring that your Homebrew environment is functioning correctly.

It’s also worth noting that Homebrew supports “taps,” which are third-party repositories that provide access to additional packages. Taps can be added using the brew tap [tap_name] command. However, be cautious when adding taps, as they may not be as well-maintained or secure as the official Homebrew repository. Now that you know how to manage packages, let’s address some common issues you might encounter.

Troubleshooting Common Issues and Best Practices

While the installation process is generally smooth, you might encounter some issues along the way. Here are some common problems and their solutions:

  • “zsh: command not found: brew”: This error typically indicates that Homebrew is not properly added to your PATH. Double-check the instructions provided by the installation script and ensure that you’ve correctly added the necessary line to your .zshrc or .bash_profile file. Remember to close and reopen the Terminal window after making changes to your PATH.
  • “Permission denied”: This error can occur if you don’t have sufficient permissions to install packages. Make sure you’re running the installation script with administrator privileges and that you’ve entered your password when prompted.
  • “Error: Cannot write to /opt/homebrew/…”: This can be due to incorrect permissions on the Homebrew directory. Try running sudo chown -R $(whoami) /opt/homebrew. This command changes the ownership of the Homebrew directory to your user account.

Following best practices can also help prevent issues. Regularly update Homebrew and your installed packages using brew update and brew upgrade. Keep your macOS system up to date with the latest security patches and bug fixes. Be cautious when installing packages from untrusted sources or taps. And always read the documentation for any package you’re installing to understand its dependencies and potential conflicts.

According to a Stack Overflow survey, “Incorrectly configured environment variables are a leading cause of Homebrew installation issues.” Stack Overflow provides a wealth of information and solutions to common Homebrew problems. If you’re still encountering issues, consider consulting the Homebrew documentation or searching for solutions online. Remember to provide as much detail as possible when asking for help, including the error message you’re seeing and the steps you’ve already taken to troubleshoot the problem. Don’t be afraid to leverage online communities for support; often, other users have encountered similar issues and can offer valuable insights. Homebrew Discussions on GitHub is an excellent place to ask questions.

Infographic here
FAQ: Installing Homebrew on M1 Mac ----------------------------------
**Do I need Rosetta 2 to use Homebrew on an M1 Mac?**
While not always required, installing Rosetta 2 is generally recommended, especially if you need to run older Intel-based software. Homebrew will automatically use Rosetta 2 when necessary.
**Where does Homebrew install packages on an M1 Mac?**
By default, Homebrew installs packages to `/opt/homebrew/` on M1 Macs.
**How do I uninstall Homebrew?**
You can uninstall Homebrew by running the uninstall script found on the official Homebrew website. Be sure to back up any important data before uninstalling.
**Is Homebrew safe to use?**
Yes, Homebrew is generally safe to use, as long as you install packages from trusted sources. Be cautious when adding third-party taps.
[Learn More About Mac Optimization](https://courthousezoological.com/n7sqp6kh?key=e6dd02bc5dbf461b97a9da08df84d31c)By following these steps and tips, you should now have a fully functional Homebrew installation on your M1 Mac. Homebrew is a powerful tool that can significantly enhance your development workflow and give you access to a vast library of software. With Homebrew up and running, you can explore the world of command-line tools and unlock the full potential of your M1 Mac. Installing developer tools like Python, Node.js, or Ruby becomes incredibly simple.

Now that you’ve successfully navigated how to install Homebrew on M1 Mac, think about all the possibilities that open up. You can streamline your development process, experiment with new technologies, and customize your Mac to perfectly suit your needs. Don’t hesitate to dive in and explore the vast world of Homebrew packages. If you found this guide helpful, share it with other M1 Mac users and help them unlock the power of Homebrew. Consider exploring related topics like “best Homebrew packages for developers” or “optimizing your M1 Mac for development” to further enhance your experience. Happy brewing!

Question & Answer :
I just got a new Mac, the M1 Macbook pro and I am trying to install homebrew, but every time I finish installing it, it tells me that it was not written to the path, and then when I try the advised whatever to add to the path, nothing happens and the terminal or whatever does not recognize the command at all, as if it isn’t installed.

This worked perfectly fine on my old Intel mac, and there is some step or whatever - I don’t know anything, and I am tired and I don’t understand how to install this at all, but hte path is supposed to be different for Apple silicon macs but nothing i read helps at all.

Homebrew installation on apple silicon, step by step:

  • Open a terminal window (it should be zsh)
  • Run this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

In my case, installation show me errors, I just installed again, and then show: Installation successful!, and warning: /opt/homebrew/bin is not in your PATH

  • Then create .zshrc on home directory (If it was not created yet). Just run on terminal:
touch ~/.zshrc 
  • Then open it to edit with TextEdit (Is a hidden file. You can show hidden files with shift + command + . )
  • Add this line at the end of .zshrc
export PATH=/opt/homebrew/bin:$PATH 
  • Run this command in terminal to make this available:
source ~/.zshrc 
  • Now just run this command to be sure that everything is working:
brew help 

This works for me to path homebrew permanently.

Or do:

- Add Homebrew to your PATH in ~/.zprofile: echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile eval $(/opt/homebrew/bin/brew shellenv)